caut_baia 9 Posting Whiz

Hello everyone.I just have a curiosity which i think i won't be able to satisify by myself.
Say we have this function :

extern "C" __declspec (dllexport) void whatever ()  {
   printf ("%s","whatever");
 }

if you try to call it from a process like this

typedef void (*pfWhatever)();
HINSTANCE lib=LoadLibrary("lib");
pfWhatever=(*pfWhatever)GetProcAddress((HMODULE))lib,"whatever");

will throw an error but calling it instead like this

pfWhatever=(*pfWhatever)GetProcAddress((HMODULE))lib,"_whatever"); //preceded by an underline

will do the job.
Thanks a lot for your time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.