thunking from 16bit to 32bit dll

This is a discussion on thunking from 16bit to 32bit dll within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I have an old application which is windows 3.1 based. Therefore the application is 16bits and is build in ...

thunking from 16bit to 32bit dll

Hello, I have an old application which is windows 3.1 based. Therefore the application is 16bits and is build in plain C. The frontend-part of the application cannot be changed (in terms of rebuild or redesign), but the backend must change. This new backend is a 32bit application. The documentation on thunking is very minimal. It allready costs me a lot of time just to gather the tools needed.
Has anyone a working sample for me.

> It allready costs me a lot of time just to gather the tools needed.
And how much more is it likely to cost before rewriting the front-end seems like a good idea?

Win3.1 is only a few years LESS obsolete than DOS.

Q1: How many bugs does your Win3.1 app have that no one dare fix because the toolchain is all broken.
Q2: How many features do you wish you had, but no one dare add because the toolchain is all broken.

Are you going to be running this "edifice" on a true win32 operating system (with the Win3.1 fossil running in a VM) or are you going to be using Win3.1 and something like the Win32s kludge to take care of the new 32-bit module?

Also, can you explain why you "must" do one thing and "cannot" do the other?

In fact the frontend is a very old legacy tool written in ObjectView, with lots and lots of functionality. As it works now, it prepairs and builds up calls to the 16bit dll. This dll then calls the bespoke "backend"-dll to do the arithmetic. Long before my time, there has been an upgrade to a 32bits environment. So yes, it is all running on win32.
The backend is changed, because the customer will use standard-software to do the calculations. The frontend will be replaced in the next few years. It will be replaced by a completely new to build bespoke application. Till then the old front-end stays in place. A thunk as an interface will be a way to overcome these years.

You have to ask yourself - how many hours it will be before you give up and just say that the whole thing has to be rewritten. If you can't find documentation on what you want to do, chances are that NOBODY has done this in a seriously long time.

- Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
- A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
- The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.