Click to See Complete Forum and Search --> : Calling 32bit Dll's from 16bit appl---(Thunk Dll's)


Jeevan Sunkersett
June 3rd, 1999, 01:44 AM
Hi,

I am tackling a situation where-in I want to access functions in a 32 bit DLL, from within a 16 bit application, under a Windows NT, 4.0 worksation environment.

For this I have found one has to resort to Thunk DLL's, "Generic Thunks" under the WinNT environment.
I have followed MSDN documentation, under
Platform SDK -- Building Appls -- Programming Techniques -- Generic Thunks
and accordingly wrote a sample 32 Dll, viz., Dll32.dll, with one exported function -- MyFunc()

I have a 16bit MFC application, MFC16.exe, built using MSVC ver1.52, from where I want to call MyFunc(), in DLL32.DLL.

So in the Mfc16, appl, I wrote the code as defined in MSDN, viz.,
Load the 32 bit library using LoadLibraryEx32W. For this one also has to add an imports section to the 16bit DEF file, defining, where to locate the LoadLibraryEx32W.

However the Mfc16, application cannot compile, giving the

error C2065: 'LoadLibraryEx32W' : undeclared identifier
error C2064: term does not evaluate to a function
error C2562: 'OnFileNew' : 'void' function returning a value


Any clues.....

thanks in advance.
Jeevan S

Robert Rolls
June 3rd, 1999, 02:43 AM
Have you added the necessary import library Kernel32.lib and included the wownt16.h header file?

Jeevan Sunkersett
June 3rd, 1999, 03:07 AM
Hi,

Thanks for u'r time & reply.
I added the Wownt16.h to my source file, and in the DEF file, under the IMPORTS section, specified

IMPORTS

kernel32.LoadLibraryEx32W
kernel32.FreeLibrary32W
kernel32.GetProcAddress32W
kernel32.GetVDMPointer32W
kernel32.CallProc32W
kernel32.CallProcEx32W

<However MSDN documentation, says it should bt kernel.LoadLibraryEx32W, but it makes no difference. Besides I only have a KERNEL32.DLL and KERNEL32.LIB on my system>

The Mfc16 project compiled correctly, but at link time it gave the error:

LINK : fatal error L1104: C:\Progra~1\DevStudio\VC\lib\kernel32.lib : not valid library

Any clues?

TIA!!!
regards
Jeevan S