I'm trying to resolve some issues with DLL conflicts by using the Windows API calls to LoadLibrary, and GetProcAddress. I'm able to get a handle to the instance of the DLL by using LoadLibrary, but cannot get a handle to the internal processes of the DLL using GetProcAddress. I'm also wondering how I'm going to call these methods once I get the pointer? Does anyone have any experience using these functions?
01 DLL-INSTANCE PIC X(4) COMP-N.
01 PROCESS-POINTER PIC X(4) COMP-N.
USING BY REFERENCE "C:\CSL\CloudSyncLib.dll",
USING BY REFERENCE DLL-INSTANCE
BY REFERENCE "CSL_InitInterface"
A terminological note: "the internal processes of the DLL" is the wrong nomenclature (and confused me when I initially read your question). The "proc" in GetProcAddress is short for "procedure", not process.
GetProcAddress wants the module handle (DLL-INSTANCE) passed by value, not by reference. And the strings passed to LoadLibrary and GetProcAddress should be nul-terminated (C-style strings with a low-value character at the end). Also, you should be calling GetProcAddressA, since you're passing an ASCII string.
I'm not an extend user (must install it and play around with it one of these days), so I don't know if it uses the z"xxx" syntax for nul-terminated strings. Maybe it knows to nul-terminate the literal string it passes to the function?
In any case, I'd suggest trying:
CALL "GetProcAddressA@WINAPI" USING BY VALUE DLL-INSTANCE BY REFERENCE "CSL_InitInterface" RETURNING PROCESS-POINTER