32 bit calling 16 bit

Hi!

We're trying to upgrade an app from PB5.02 - 16 bit to 6.5. The trouble is
that we call a lot of third-party 16 bit DLL's. Both our interface and the
third party part does database calls (MS SQL Server 6.5 SP5). Can anyone
shed some light on how we'd do this? (One friend mentioned we needed a
"thunk" layer. Another didn't think you could "thunk" PB. I don't know
enough about "thunk" to know what to think...).

Thanks!

Dennis



0
PCI
2/4/1999 4:12:03 PM
sybase.powerscript 7704 articles. 0 followers. Follow

4 Replies
756 Views

Similar Articles

[PageSpeed] 9

Dennis,

>We're trying to upgrade an app from PB5.02 - 16 bit to 6.5. The trouble is
>that we call a lot of third-party 16 bit DLL's. Both our interface and the
>third party part does database calls (MS SQL Server 6.5 SP5). Can anyone
>shed some light on how we'd do this? (One friend mentioned we needed a
>"thunk" layer. Another didn't think you could "thunk" PB. I don't know
>enough about "thunk" to know what to think...).


Yes, you do need a thunking layer, microsoft has documentation on how to do
this (and it's not so easy). I know that you have to write 32 bit DLL's (in
C(++) ) to perform the actual thunking (PB calls the 32 bit thunking DLL,
and the thunking DLL calls the actual 16 bit DLL).

Wish you luck !

Rick Peters
rick.peters@cmg.nl



0
Rick
2/5/1999 10:25:18 AM
Thanks Rick!

This gives me a good place to start.

Dennis

Rick Peters wrote in message <9Wz2LDPU#GA.205@forums.powersoft.com>...
>Dennis,
>
>>We're trying to upgrade an app from PB5.02 - 16 bit to 6.5. The trouble is
>>that we call a lot of third-party 16 bit DLL's. Both our interface and the
>>third party part does database calls (MS SQL Server 6.5 SP5). Can anyone
>>shed some light on how we'd do this? (One friend mentioned we needed a
>>"thunk" layer. Another didn't think you could "thunk" PB. I don't know
>>enough about "thunk" to know what to think...).
>
>
>Yes, you do need a thunking layer, microsoft has documentation on how to do
>this (and it's not so easy). I know that you have to write 32 bit DLL's (in
>C(++) ) to perform the actual thunking (PB calls the 32 bit thunking DLL,
>and the thunking DLL calls the actual 16 bit DLL).
>
>Wish you luck !
>
>Rick Peters
>rick.peters@cmg.nl
>
>
>


0
PCI
2/5/1999 2:36:26 PM
Rick:

Just to add to what you said, the type of thunk we are taking about is
called a 'flat thunk', which supports calls from 32-bit code to 16-bit code,
and vice versa.  Flat thunks are only supported on Windows 95 (and, I assume
on Windows 98), but not on Windows NT.  Windows NT supports 'generic thunks'
which only allow calls from 16-bit code to 32-bit code, but not the other
way around.

From what I recall, to create a flat thunk you need to create a thunk script
(which is the function prototype with additional information about input and
output variables), and run it through the thunk compiler.  The output of the
thunk compiler is an assembly language file.  You would then need to
assemble the ASM file twice, once to produce the 16-bit object module, and
once to produce the 32-bit object module.  The object modules are then
linked to their respective 16-bit and 32-bit DLLs.  The end result of the
process is a 16-bit DLL, and a 32-bit DLL, i.e., the two 'sides' of the flat
thunk.

To do this you will need, at least, the thunk compiler, MASM, and a linker.

It think it would look something like this:

Some 32-bit app<-->32-bit DLL (flat thunk)<-->16-bit DLL (flat
thunk)<-->Some 16bit DLL

HTH
Scott


Rick Peters wrote in message <9Wz2LDPU#GA.205@forums.powersoft.com>...
>Dennis,
>
>>We're trying to upgrade an app from PB5.02 - 16 bit to 6.5. The trouble is
>>that we call a lot of third-party 16 bit DLL's. Both our interface and the
>>third party part does database calls (MS SQL Server 6.5 SP5). Can anyone
>>shed some light on how we'd do this? (One friend mentioned we needed a
>>"thunk" layer. Another didn't think you could "thunk" PB. I don't know
>>enough about "thunk" to know what to think...).
>
>
>Yes, you do need a thunking layer, microsoft has documentation on how to do
>this (and it's not so easy). I know that you have to write 32 bit DLL's (in
>C(++) ) to perform the actual thunking (PB calls the 32 bit thunking DLL,
>and the thunking DLL calls the actual 16 bit DLL).
>
>Wish you luck !
>
>Rick Peters
>rick.peters@cmg.nl
>
>
>


0
Scott
2/5/1999 6:26:50 PM
Scott,

thanks for the clarification. This makes me even more happy that I don't
have to do this !

>Just to add to what you said, the type of thunk we are taking about is
>called a 'flat thunk', which supports calls from 32-bit code to 16-bit
code,
>and vice versa.  Flat thunks are only supported on Windows 95 (and, I
assume
>on Windows 98), but not on Windows NT.  Windows NT supports 'generic
thunks'
>which only allow calls from 16-bit code to 32-bit code, but not the other
>way around.

This sounds very illogical, because you have 16 bits (legacy) dll's you want
to use from 32 bit code. What you say (and I wouldn't dare to doubt it :-) )
implies that this isn't possible on windows NT ??

>To do this you will need, at least, the thunk compiler, MASM, and a linker.

Yak !!

>Some 32-bit app<-->32-bit DLL (flat thunk)<-->16-bit DLL (flat
>thunk)<-->Some 16bit DLL

But not on NT I gather form your story ??

Rick Peters
rick.peters@cmg.nl



0
Rick
2/8/1999 12:08:04 PM
Reply: