GetProcAddress returns NULL

I am trying to load a dll using LoadLibrary and GetProcAddress. LoadLibrary returns a valid handle, but my GetProcAddress calls return NULL. A call to GetLastError returns 87, which is ERROR_INVALID_PARAMETER. I checked that the name of the function that I pass to GetProcAddress is the same as when I run it dumpbin /exportsin the dll. Unfortunately, this is for work, so I cannot include the actual code. But here is the version given to give you an idea of ​​what I am doing.

HINSTANCE hDLL = NULL;

hDLL = LoadLibrary(L"<PATH TO DLL>");

if (hDLL == NULL)
{
    // error handling code
}

g_var1 = (VAR1_TYPE) GetProcAddress(hDLL, L"Function1Name");
g_var2 = (VAR2_TYPE) GetProcAddress(hDLL, L"Function2Name");

if (!g_var1 ||
    !g_var2 )
{
    // error handling code
}

I looked at a number of related issues on SO and other forums, but usually the problem is with the C ++ name change. Since I use the same name that shows dumpbin, I do not think this is my problem. Any ideas?

UPDATE

, , , . DLL ( WinCE). dll, , ; unfortuanatley dll. dll , dll, , . GetProcAddress DLL , . , , LoadLibrary dll, DLL, . - , ?

Windows CE DLL, , , DLL. , DLL , . , , .cpl, , .dll.

: http://msdn.microsoft.com/en-us/library/ms886736.aspx

+4
1

, . DLL, LoadLibrary DLL .

MSDN:

lpFileName , , , .

, DLL, , LoadLibrary.

+1

Source: https://habr.com/ru/post/1545094/


All Articles