Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!csn!boulder!spot.Colorado.EDU!hartkopf From: hartkopf@spot.Colorado.EDU (Jeff Hartkopf) Newsgroups: comp.sys.apple2 Subject: Stack problems with IIGS code resources Keywords: Apple IIGS, programming, code resources Message-ID: <1991May11.022741.25916@colorado.edu> Date: 11 May 91 02:27:41 GMT Sender: news@colorado.edu (The Daily Planet) Organization: University of Colorado, Boulder Lines: 31 Nntp-Posting-Host: spot.colorado.edu Is there anything weird to know about the stack when using code resources? I ask because I'm having some strange problems using them from an NDA and I'm not sure what's causing the problems. Here's what I'm doing and what's going wrong: I write the code resource function with ORCA/C, and it takes several various sized parameters (ints, pointers, etc.). I then copy the compiled and linked function into my resource fork using the Genesys Import option. In my NDA (also written with ORCA/C) I do the required stuff to load the code resource, lock it in place, and call it. Generally the call to the code resource function works smoothly. However, sometimes if I change the number of parameters to the code resource function, or add or take away some local variables in the code resource function, some things don't work quite right. Sometimes the function's return value isn't returned properly (e.g., I return an int value 0 but get back a garbage value). Other times if I modify the contents of a variable pointed to by a pointer parameter to the function, it doesn't get modified properly. Usually, adding a new local variable or parameter to the function fixes the problem. So it seems like the problem has something to do with the stack getting messed up. Very strange problem. Any ideas, anyone? Thanks! Jeff Hartkopf University of Colorado at Boulder Internet: hartkopf@spot.colorado.edu