but how do I know the symbol’s name? What kind of a name is the one for
Windows anyway? I found it out with depview from the Platform SDK, but I’d
rather have my function exported as “GetInformation”, since it’s the only
one like that in the dll (not overloaded or anything).
You can do something special to not get mangled names in Windows, since it
is possible to call GetProcAddress with the same name you would normally
call the function with.
I think I did it by creating a .DEF file and adding it to my VC++ project.
For example, suppose your pluggable AI’s DLL name is: MegaBrain.DLL.
Presumably, your project has MegaBrain.cpp or MegaBrain.c. Create a text
file and call it MegaBrain.DEF and add the following text to it:
Besides, I think you can just call the functions directly (assuming you’re
exposing the same interface from all plugins) and just replace the DLL (just
like if you were upgrading the SDL DLL, for example), unless you’re doing
weird tricks like loading many AI libraries simultaneously.
…BTW, I think you have to call CloseLibrary in Win32, otherwise you might
Olivier A. Dagenais - Software Architect and Developer