CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    16

    Calling 32bit Dll's from 16bit appl---(Thunk Dll's)

    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



  2. #2
    Join Date
    May 1999
    Posts
    30

    Re: Calling 32bit Dll's from 16bit appl---(Thunk Dll's)

    Have you added the necessary import library Kernel32.lib and included the wownt16.h header file?


  3. #3
    Join Date
    May 1999
    Posts
    16

    Re: Calling 32bit Dll's from 16bit appl---(Thunk Dll's)

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured