Board index » delphi » Can I use Delphi 16 Bit DLL in VB 4.0 32 Bit program

Can I use Delphi 16 Bit DLL in VB 4.0 32 Bit program

Hi,

I am trying to use a DLL created using Delphi 1.0 in VB 4.0 application.
But I get VB Error # 48 - Error in Loading DLL problem.  What
am I doing wrong?

Also, how do I pass a string from VB to Delphi DLL funtion.  The Pascal
string convention needs first byte indicating the length of the string
and VB does not have the length byte.  I hope I am not asking very
basic question, since I am very new to Delphi.

Thanks in advance.

Girish

 

Re:Can I use Delphi 16 Bit DLL in VB 4.0 32 Bit program


Quote
giri...@netcom.com (Girish Andalkar) wrote:
>I am trying to use a DLL created using Delphi 1.0 in VB 4.0 application.
>But I get VB Error # 48 - Error in Loading DLL problem.  What
>am I doing wrong?

32 bit programs, such as VB4/32, cannot load or make calls to 16 bit DLL's.
You will either have to wait for Delphi32, or use the 16 bit version of VB.

There is something called "thunking", for going from one bitness to the
other, but it is quite complicated.

Quote
>Also, how do I pass a string from VB to Delphi DLL funtion.  The Pascal
>string convention needs first byte indicating the length of the string
>and VB does not have the length byte.  I hope I am not asking very
>basic question, since I am very new to Delphi.

You need to use the PChar type in Delphi, which is a C compatible null
terminated string. Then in VB, you would follow its rules for passing null
terminated strings to DLLs. (See the VB doc on calling DLLs.)

--
Brad Aisa, Toronto, Ontario, Canada
ba...@hookup.net   web archive: http://www.hookup.net/~baisa/

"The highest responsibility of philosophers is to serve as the
guardians and integrators of human knowledge."   -- Ayn Rand

Other Threads