I recently posted a query on exporting functions from a DLL. I am posting again as I have slightly more information, but still need help.

My problem is that if I declare, in my DLL:
---
extern "C"
{
void _declspec(dllexport) _stdcall DLL_HelloWorld(void);
}
---

and in my test program, which wants to use the DLL:

---
void (FAR *lpfnHelloWorld)(void);

lpfnHelloWorld =
(void (FAR *)(void) )::GetProcAddress(hInstDLL,"DLL_HelloWorld");


---

lpfnHelloWorld always ends up as NULL.

Someone suggested that I use dumpbin to see what was being exported; sure enough, I see:

---
ordinal XXXXX name
1 0 _DLL_HelloWorld@0


---

Presumably this IS the unmangled version, as the gibberish on the end of the name gets worse if I don't use extern "C".

So, if the function is being exported OK, why can't GetProcAddress() find it by name?

I say 'by name' because I tried:

---
void (FAR *lpfnHelloWorld)(void);

lpfnHelloWorld =
(void (FAR *)(void) )::GetProcAddress(hInstDLL,(LPCSTR)(DWORD)1);


---

and Bingo! It worked.

Now, why can't the function find the name when it CAN find the ordinal? I don't want to use ordinals as they don't mean anything to anyone reading the code, and might change.

Any ideas?