There must be a function with the non-mangled name impFcn in the dll you are loading or GetProcAddress() will return null. You have not given us any of the DLL code so there is no way we can tell you what is wrong.

It's for both C and C++. When it compiles, the main function doesn't recognize the imported DLL function.

Declare all of your DLL imports as "extern C". C++ functions are by default subject to name-mangling (which necessarily precludes class members from being used as such entry points, of course). Also, be explicit about your calling convention (lest you break your ABI elsewhere, too)...

Wow I cannot believe I did not see that but you are absolutely right. impFcn will go out of scope at the end of the function. Most of use were concentrating on what the function was doing instead of seeing the obvious problem of scope. Nice catch.