Archived

This topic is now archived and is closed to further replies.

Ridcully

exporting functions in c++ from a dll

Recommended Posts

i am using run-time linking to import functions from a dll. now if i use GetProcAdress() i can''t just give an argument with the name of the desired function (as it should be) but i must use the depended viewer and copy the exported function name and paste it in vc. it looks something like "?InitDll@@YEKS" instead of plain InitDll then. i think this has got something to do with c++ calling conventions, but i ain''t sure at all. so how do i have to export the function in the dll in to import it with the proper name? thanks ridcully

Share this post


Link to post
Share on other sites
the name is mangled because of c++ compilation
you have to make the functions names complie as c names
do this by:

__declspec(dllexport) extern "C" int Foo(int Bob);

or something like that
its been a while -- i havent written a dll in months

Share this post


Link to post
Share on other sites