Board index » delphi » Using 16-bit DLLs in D 2

Using 16-bit DLLs in D 2

I have a program that requires the use of a
3rd Party 16-bit DLL.  

We are porting our project over to Delphi 2.0
for Windows 95.  Our program compiles, but
an error occurs immediately during the start of
execution.  I understand that using 16-bit
DLLs requires an intermediate process called
"thunking".

What is required to use 16-bit DLLs in
Delphi 2.0?  

Is there a good reference on interfacing
16-bit DLLs?

Does thunking involve some Microsoft Resources
(and does acquisition of these resources
require expenditure of capital)?

Thanks in advance,

Hal Hayes      
hha...@mnsinc.com

 

Re:Using 16-bit DLLs in D 2


Quote
Hal Hayes wrote:

> I have a program that requires the use of a
> 3rd Party 16-bit DLL.

> We are porting our project over to Delphi 2.0
> for Windows 95.  Our program compiles, but
> an error occurs immediately during the start of
> execution.  I understand that using 16-bit
> DLLs requires an intermediate process called
> "thunking".

> What is required to use 16-bit DLLs in
> Delphi 2.0?

> Is there a good reference on interfacing
> 16-bit DLLs?

> Does thunking involve some Microsoft Resources
> (and does acquisition of these resources
> require expenditure of capital)?

> Thanks in advance,

> Hal Hayes
> hha...@mnsinc.com

I spent a long time trying to get a 16 bit DLL working
from a 32 bit app, and finally rang Borland support. The
person I spoke to told me that thunking was not reliable
in Delphi 2.0 (he hinted that it was nearly impossible),
and the best way was to use a 'C' DLL. Fortunately I had
just got Borland C++ 5.0, and it didn't take long to
copy an example from the Win32 SDK and get it working.
The best place to look for guidance on thunking is the
MSDN, but briefly: you need to call a 32bit DLL that
grabs UTRegister from Kernel32.DLL, registers a thunk to
16 bits, specifying a 16 bit DLL and an 'init' and 'proc'
function. The 'proc' function in the 16 bit DLL determines
which function to call in yet another 16 bit DLL by
switching on the index passed as an argument to it. Maybe
too brief, but that's the jist,

Hope this helps,

Jon

Other Threads