using 16bit code
- Posted by m.lerer at USA.NET Jun 18, 1998
- 763 views
Dear Pete, Re: using 16bit DLL's in win32. I'm also curious about this. I've found some info on the web, but none of it is particularly helpful. The following is from Dr Dobbs Journal (4/1996). See: http://www.ddj.com/ddsbk/1996/1996_03/pietrek.htm http://www.ddj.com/ddsbk/1996/1996_04 1. Microsoft's SDK has a thunk compiler (thunk.exe) that creates a 32bit DLL that calls your 16bit DLL. 2. There are some undocumented API functions in kernel32: LoadLibrary16(), FreeLibrary16(), GetProcAddress16(), and QT_Thunk() which are supposed to handle this. There are some problems: 1. The xxx16() functions are not listed in any dump of kernel32.dll; you need to be able to access kernel32.dll by function **number**, not function name. Pietrek includes an import lib in his archive, but this doesn't work for me with my c compiler (lcc-win32). Maybe it will for you. 2. QT_Thunk calls the 16bit code correctly, but you have to set the stack up just as the called function expects it, in assembly. Also, any return value has to be retrieved from the appropriate register. 3. Pietrek refers to thunk32.lib in his makefile. It's supposed to come with MSVC++, which I don't have. I don't know if this is vital, or just a convenience. There are more archives available from the microsoft ftp site ft://ftp.microsoft.com, but these are concerned with getting 16bit code running on WIN32 to use 32bit DLL's. One that might be useful is MTHUNK32.EXE, but this requires thunk32.lib again. bye, nonlerer ____________________________________________________________________ Get free e-mail and a permanent address at http://www.netaddress.com/?N=1