Board index » delphi » Using 16-bit DLL's with Delphi 2.0

Using 16-bit DLL's with Delphi 2.0

Hi,

I think this topic has come up here before, but I hope someone can
point me in the right direction.

I have a 3rd-party 16-bit DLL that I used successfully in a Delphi 1.0
app. I am now porting the app to Delphi 2.0 but I cannot get my app to
work with the DLL. In the IDE when trying to run I get the useless
error message 'De{*word*81} kernel error. Error code: 1'. When I run the
app independently, Win95 says the DLL is corrupt (even though it is
not). How do I get Delphi 2.0 to recognise existing 16-bit DLL's?

Thanks in advance,

Julian van Tubbergh.

 

Re:Using 16-bit DLL's with Delphi 2.0


In article <557uis$...@news1.saix.net>, jul...@igubu.saix.net says...

Quote

>I think this topic has come up here before, but I hope someone can
>point me in the right direction.
>not). How do I get Delphi 2.0 to recognise existing 16-bit DLL's?

In order to get any kind of communication between 16-bit and 32-bit
processes, you have to use a technique known as thunking.  It's too
complicated to explain in a news article.  Suffice it to say that
it's a major undertaking.  The bottom line is you basically wind
up with another DLL that acts as a middleman between your 32 bit
app, and your 16 bit app.  It has to do a lot of re-mapping and
translating to get everything to work.  It's usually better just
to recreate the functionality of the 16 bit DLL as 32 bit, if it's
one you did yourself.  If it's a vendor DLL, see if they've got a
32-bit version of it.  Thunking is a last, desperate resort.

jdm1i...@airmail.net

Re:Using 16-bit DLL's with Delphi 2.0


On 30 Oct 1996 19:30:57 GMT, jdm1i...@airmail.net (John Morrison)
wrote:

Quote
>In article <557uis$...@news1.saix.net>, jul...@igubu.saix.net says...

>>I think this topic has come up here before, but I hope someone can
>>point me in the right direction.

>>not). How do I get Delphi 2.0 to recognise existing 16-bit DLL's?

>In order to get any kind of communication between 16-bit and 32-bit
>processes, you have to use a technique known as thunking.  It's too
>complicated to explain in a news article.  Suffice it to say that
>it's a major undertaking.  The bottom line is you basically wind
>up with another DLL that acts as a middleman between your 32 bit
>app, and your 16 bit app.  It has to do a lot of re-mapping and
>translating to get everything to work.  It's usually better just
>to recreate the functionality of the 16 bit DLL as 32 bit, if it's
>one you did yourself.  If it's a vendor DLL, see if they've got a
>32-bit version of it.  Thunking is a last, desperate resort.

Not necessarily ...
Articles in The Delphi Magazine issues 12 & 13 help out greatly - the
latest source code to the generic Call16BitRoutine function can be
found on the Issue 15 disk ... although there is a small resource leak
- update pending (If you get the source, I can tell you where it is).

Check out :-

http://members.aol.com/delphimag/thunk95.htm

Cheers,

Russ.

Other Threads