Board index » delphi » Calling a Delphi DLL from Visual Basic 4.0

Calling a Delphi DLL from Visual Basic 4.0

I designed a DLL with Delphi 2.0. I call this DLL from a Visual Basic 4.0
Application.  When I run the EXE file, there is no problem, but when I run
my application from the VB 4.0 IDE, if the DLL is called, I get a GPF when
I quit VB. If I run my application from the VB 4.0 IDE and the DLL is not
called, there is no problem.

Can anyone tell me what is going on?

Could this raise errors in the EXE that I didn't notice yet?

-----------------------------
Ghislain Gadbois
Sisca inc.
Sherbrooke (Qu.)
E-Mail: Ghislain.Gadb...@sisca.qc.ca

 

Re:Calling a Delphi DLL from Visual Basic 4.0


Did you use the FreeLibrary to destroy the instance of library?

Xiao

Quote
Ghislain Gadbois wrote:

> I designed a DLL with Delphi 2.0. I call this DLL from a Visual Basic 4.0
> Application.  When I run the EXE file, there is no problem, but when I run
> my application from the VB 4.0 IDE, if the DLL is called, I get a GPF when
> I quit VB. If I run my application from the VB 4.0 IDE and the DLL is not
> called, there is no problem.

> Can anyone tell me what is going on?

> Could this raise errors in the EXE that I didn't notice yet?

> -----------------------------
> Ghislain Gadbois
> Sisca inc.
> Sherbrooke (Qu.)
> E-Mail: Ghislain.Gadb...@sisca.qc.ca

Re:Calling a Delphi DLL from Visual Basic 4.0


In VB, one of the biggest generators of the {*word*193} GPF is of course memory
leaks.  VB is notorious for creating their own (yes..VB does) and
applications (DLLs) that have them cause this type of behavior (GPF'ing
when the application is terminated).

Make sure you have free'ed up all of your allocations.  This same thing
happened to us when creating a C DLL calling it from VB.

Good Luck

Pa...@qni.com

___________________________________________
http://www.qni.com/~paulj/

"I can do all things through Him who gives me strength"  Phil. 4:13

On 8 Apr 1997, Ghislain Gadbois wrote:

Quote
> I designed a DLL with Delphi 2.0. I call this DLL from a Visual Basic 4.0
> Application.  When I run the EXE file, there is no problem, but when I ru=
n
> my application from the VB 4.0 IDE, if the DLL is called, I get a GPF whe=
n
> I quit VB. If I run my application from the VB 4.0 IDE and the DLL is not
> called, there is no problem.
>=20
> Can anyone tell me what is going on?
>=20
> Could this raise errors in the EXE that I didn't notice yet?
>=20
> -----------------------------
> Ghislain Gadbois
> Sisca inc.
> Sherbrooke (Qu=E9.)
> E-Mail: Ghislain.Gadb...@sisca.qc.ca
>=20
>=20

Re:Calling a Delphi DLL from Visual Basic 4.0


I finally had a reply from two persons that have been able to help me.

The problem was in passing parameters to my DLL.

My Delphi functions returned and received Integer values.  From VB, I was
passing Integers too.  However, Delphi Integers are not the same as VB
Integers.  So, I changed Delphi Integers for LongInts and VB Integers for
Long and every thing worked out fine!

Hope this will help someone else...

Ghislain Gadbois <Ghislain.Gadb...@sisca.qc.ca> wrote in article
<5idoct$...@nr1.ottawa.istar.net>...

Quote
> I designed a DLL with Delphi 2.0. I call this DLL from a Visual Basic 4.0
> Application.  When I run the EXE file, there is no problem, but when I
run
> my application from the VB 4.0 IDE, if the DLL is called, I get a GPF
when
> I quit VB. If I run my application from the VB 4.0 IDE and the DLL is not
> called, there is no problem.

> Can anyone tell me what is going on?

> Could this raise errors in the EXE that I didn't notice yet?

> -----------------------------
> Ghislain Gadbois
> Sisca inc.
> Sherbrooke (Qu.)
> E-Mail: Ghislain.Gadb...@sisca.qc.ca

-----------------------------
Ghislain Gadbois
Sisca inc.
Sherbrooke (Qu.)
E-Mail: Ghislain.Gadb...@sisca.qc.ca

Re:Calling a Delphi DLL from Visual Basic 4.0


In article <5ig93h$...@nr1.ottawa.istar.net>,

Quote
"Ghislain Gadbois" <Ghislain.Gadb...@sisca.qc.ca> wrote:
>I finally had a reply from two persons that have been able to help me.

>The problem was in passing parameters to my DLL.

>My Delphi functions returned and received Integer values.  From VB, I was
>passing Integers too.  However, Delphi Integers are not the same as VB
>Integers.  So, I changed Delphi Integers for LongInts and VB Integers for
>Long and every thing worked out fine!

>Hope this will help someone else...

It probably will help me, as I haven't started using Delphi yet :)
What is the difference between a VB integer and a Delphi integer?
Isn't an integer 16bit and a long 32 bit, in VB both signed?

--
|| Bjorn K. Nilssen      // http://home.sn.no/~bjoernk/  // mainly 3D ||

Other Threads