I need a string to be shared between all instances of my dll. Also, I need
to append the string with each new instance of the dll.
The string is declared:
#pragma bss_seg("MYBSS" )
WCHAR* wFilenames;
#pragma bss_seg()
#pragma comment (linker,"/SECTION:MYBSS,r ws")
There is a routine which is called once only per instance which recieves
another string to append to wFilenames:
QUICKEDITDLL bool STDCALL AddFilename(LPW STR fn)
{
int s=(lstrlenW((LP CWSTR)wFilename s)+lstrlenW((LP CWSTR)fn)+2)*si zeof(WCHAR);
// Plus 2 to accomedate a semicolon and a null char
WCHAR* nS=(WCHAR*)mall oc(s);
ZeroMemory(nS,s );
lstrcpyW(nS,wFi lenames);
//free(wFilenames );
wFilenames=(WCH AR*)realloc(wFi lenames,s);
ZeroMemory(wFil enames,s);
lstrcpyW(wFilen ames,nS);
lstrcatW(wFilen ames,fn);
lstrcatW(wFilen ames,L";");
MessageBoxW(NUL L,wFilenames,NU LL,MB_OK);
free(nS);
return true;
}
wFilenames only ever holds the last string ( fn ).
I'm stumped but I'm sure I've just missed something but I don't know what.
to append the string with each new instance of the dll.
The string is declared:
#pragma bss_seg("MYBSS" )
WCHAR* wFilenames;
#pragma bss_seg()
#pragma comment (linker,"/SECTION:MYBSS,r ws")
There is a routine which is called once only per instance which recieves
another string to append to wFilenames:
QUICKEDITDLL bool STDCALL AddFilename(LPW STR fn)
{
int s=(lstrlenW((LP CWSTR)wFilename s)+lstrlenW((LP CWSTR)fn)+2)*si zeof(WCHAR);
// Plus 2 to accomedate a semicolon and a null char
WCHAR* nS=(WCHAR*)mall oc(s);
ZeroMemory(nS,s );
lstrcpyW(nS,wFi lenames);
//free(wFilenames );
wFilenames=(WCH AR*)realloc(wFi lenames,s);
ZeroMemory(wFil enames,s);
lstrcpyW(wFilen ames,nS);
lstrcatW(wFilen ames,fn);
lstrcatW(wFilen ames,L";");
MessageBoxW(NUL L,wFilenames,NU LL,MB_OK);
free(nS);
return true;
}
wFilenames only ever holds the last string ( fn ).
I'm stumped but I'm sure I've just missed something but I don't know what.
Comment