so i'm writing a DLL and generally have the hang of things, but there is a quirk which is driving me crazy and i can't figure it out. it's one of those "how can this one thing possibly affect the other?" bugs.
so here goes...
* i've got lots of working functions that take multiple int parms and spit back int values. they all work fine. typical string table entries might be: INT FUNC[%LL%?myIntFunc@@YAHHH@Z or INT FUNC2[%LLL%?myIntFunc2@@YAHHH@Z
* i've got a working test function that takes no args and spits out a string. it's string entry looks kind of like: STR FUNC[%S%?myStrFunc@@YAKXZ
so far so good.
now all of these functions make use of a global map collection that is referred to by an index. so a typical function looks like:
int getInfoInt(int mapIndex) {
// no intervening code
MAP_PTR_TYPE mp = globalCollectonOfMaps[mapIndex];
if( ! mp ) {
// freak out and report error
}
// do stuff
return retVal;
}
this works fine for a million little functions returning ints. however it consistently reports a bad map index any time i try to return a string. so, for instance:
DWORD getInfoString(int mapIndex) {
// no intervening code
// this next line will report bad index
MAP_PTR_TYPE mp = globalCollectonOfMaps[mapIndex];
if( ! mp ) {
// freak out and report error
}
// do stuff
return (DWORD) retVal;
}
this might have the string table entry: STR FUNC[%SL%?myStrFunc@@YAKXZ
so, to try and put it all together and explain... within DB i can have the following lines:
index = 1
a = INT FUNC(index) // won't complain
s$ = STR FUNC(index) // claims bad index, but it hasn't changed!!!
any tests i do where i set the index internally, make the problem go away. so for example:
index = 1
a = INT FUNC(index) // won't complain
s$ = TEST STR FUNC() // won't complain
argh! this is driving me nuts. does any one have some insight or sample code to share?
yours in madness,
--skyser