I wonder if it is possible to link 16-bit lib or obj files with 32-bit lib or obj files.
Related: How can you use the 16-bit LoadLibrary call in assembler?
Any ideas?
google the term "thunk"
although, i can't imagine why :P
Quote from: dedndave on December 12, 2013, 10:23:12 PM
google the term "thunk"
although, i can't imagine why :P
Thunking from 16-bit Windows 3.1 code to a 32-bit DLL is easy, but that's not the problem. I'd like to link statically.
Quote from: jj2007 on December 12, 2013, 10:56:10 PM
I'd like to link statically.
That's no problem - so long as you don't try to call the 16-bit code. There's no relocation type for a 16-bit far call in the PE format.
I'd like to call the 32-bit code from the 16-bit code. One option I see is to load relocatable 32-bit code into 16-bit memory, and call it from there with CallProc32W.
But how can I get the address of CallProc32W from a 16-bit DOS program?
You might have to put the 32-bit code in a dll.
QuoteWindows NT, Windows 95, Windows 98, and Windows 2000 do not allow direct mixing of 16-bit code and 32-bit code in the same process.
QuoteGeneric thunks allow a 16-bit Windows-based application to load and call a Win32-based DLL.
http://support.microsoft.com/kb/125710
Quote from: jj2007 on December 12, 2013, 11:41:43 PM
But how can I get the address of CallProc32W from a 16-bit DOS program?
I'd say that's not possible.
A 16-bit DOS real-mode program in XP that wants to execute 32-bit may do
- call exports of a Win32 dll ( using so-called BOPs ) OR
- switch to protected-mode via DPMI and then call 32-bit code directly ( after having done some low-level selector stuff ).
Oops, didn't see the DOS bit. Maybe your DOS program could talk to a 16-bit Windows .vxd which could then talk to a 32-bit .dll
Quote from: sinsi on December 13, 2013, 12:00:59 AM
You might have to put the 32-bit code in a dll.
That's what I always did, but I'd like to go the static linking route. BOPs sounds interesting, though. Actually, it's a 16-bit Win app that calls the code, but for testing, 16-bit console would be nice...
http://www.masmforum.com/board/index.php?topic=12823;prev_next=next
Thanks, John & Dave & Japheth - I knew I had seen that BOP stuff before ;-)