Runtime error when accessing static data in a DLL
Phil Deets
pjdeets2 at gmail.com
Thu Dec 24 07:49:01 PST 2009
I'm writing a DLL in D which will be loaded (not automatically, but by
LoadLibrary) by a C application (the Lua interpreter). I'm having problems
with globals and static data. Everything is fine if I only access stuff on
the stack, but as soon as I access a global or a static class variable,
either the program crashes or if I am still in DllMain, the LoadLibrary
function will fail and GetLastError will indicate an error with the
message "Invalid access to memory location.".
I'll work on reproducing it in a smaller scale, but does anyone know how
to fix it?
In case it is helpful info, in DllMain under the DLL_PROCESS_ATTACH case,
I am just calling Runtime.initialize; even though the sample calls
gc_init, _minit, _moduleCtor, and runModuleUnitTests.
More information about the Digitalmars-d-learn
mailing list