Hello,

My Project is divided into many files.

its like this:
main.c
modul1.c modul1.h
modul2.c modul2.h
modul3.c modul3.h

as it growed too big for one resource, I put each of the moduls in an own
section. 

First I dont reaaized it, but now some bugs appeared which were earlier not
present.

in modul1.c I have a line like this:

static UInt16 variable1 = 7;

but as I ran the application it was never shown with a value of 7.

I debugged (with the the gdb-multiSec-Patch), and watching the variable soon
discoverd the change from the inital 7 to another (random) value this:

in modul2.c I have another static variable
static MyStructType variable2;

static void loadVariable()   {
    MemHandle recordHandle;
    MemPtr recordPtr;

    recordHandle = DmQueryRecord(dbHandle, 0);
    recordPtr = MemHandleLock(recordHandle);
    MemMove(&variable2, recordPtr, sizeof(MyStructType));
    MemHandleUnlock(recordHandle);
}

The  line Making trouble is:
    MemMove(&variable2, recordPtr, sizeof(MyStructType));
it changed the value of variable1 instead of variable2 (which contents
    remained untouched).
I dont know what I did wrong, or what cause this problem.

I dont think that the MemMove() is broken, because when the program is left,
variable2 should be stored back in the DB, but instead variable1 is stored.
So there he references also the wrong variable. 

Anything I missed in the multisection-doc about globals/static variables?

Thanks in Advance
Florian
-- 
int m,u,e=0;float l,_,I;main(){for(;1840-e;putchar((++e>907&&942>e?61-m:u)
["\t#*fg-pa.vwCh`lwp-e+#h`lwP##mbjqloE"]^3))for(u=_=l=0;79-(m=e%80)&&
I*l+_*_<6&&26-++u;_=2*l*_+e/80*.09-1,l=I)I=l*l-_*_-2+m/27.;}

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to