Board index » delphi » Calling a 16 bit DLL proc in Delphi 2.01

Calling a 16 bit DLL proc in Delphi 2.01

Is there any simple solution for the following problem?

I would like to call a procedure in a 16bit DLL from a 32bit Delphi 2.01
app. There are no pointers etc. to share, only an longint parameter. How
may I call this 16bit proc out of the 32bit app? Any hints?

Thanks!

Manfred

 

Re:Calling a 16 bit DLL proc in Delphi 2.01


On Thu, 01 May 1997 21:44:13 +0200, Manfred Mueller-Spaeth

Quote
<Manfred.MSpa...@darmstadt.netsurf.de> wrote:
>Is there any simple solution for the following problem?

Simple answer - No.

Quote

>I would like to call a procedure in a 16bit DLL from a 32bit Delphi 2.01
>app. There are no pointers etc. to share, only an longint parameter. How
>may I call this 16bit proc out of the 32bit app? Any hints?

>Thanks!

>Manfred

You will need to Thunk to the 16 bit dll.  If you have access to the
MS Developer Network CD, you'll find very terse information there.
They have a thing called a Thunk Compiler.  Essentially, it works like
this:

1) create a script (they tell you how) to define the interface to the
function you want to call in the 16 bit dll.  You'll need to create
two scripts - one for 16 bit one for 32 bit.

2) You need to create a 32 bit and a 16 bit dll.  Your exe will call
the 32 bit dll, which calls the new 16 bit dll, which calls the
original 16 bit dll.

3) run the scripts through the thunk compiler.  It generates an
assembly file for 16 and 32 bits.   Compile them into obj files.
These have to be linked into the new 16 and 32 bit interface dlls you
created in step 2.

On and on...  It's in the docs.  

The asm files create the "bridge" between the calling interfaces for
the 32 to 16 bit worlds.  Your 32 bit exe calls the 32 bit dll.  The
32 bit dll has the asm output obj file linked into it.  It calls a 16
bit dll that has the 16 bit obj file  linked into it.  Then the 16 bit
file calls the original 16 bit dll you were after all along.

Fun  huh?

That's why most people gripe, but then convert the 16 bit dll to 32
bits.

david sampson

dsamp...@atlanta.com

Other Threads