Adding External DLL Calls

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Adding External DLL Calls

Post by Jeff Barnes »

Hi Everybody,

I have looked at many posts and am trying to add external DLL calls to my app.

Can someone please tell me where I am going wrong.


Syntax :
Function Connect() as String
Return values:
Success - Port number
Error - Empty String

DLL32 FUNCTION Connect() AS LPSTR PASCAL LIB "\Ez\dll\POx.DLL"



Syntax :
Function Handshake() as Boolean
Return values:
Success - TRUE
Error - FALSE

DLL32 FUNCTION Handshake() AS BOOL PASCAL LIB "\Ez\dll\POx.DLL"



Syntax :
Function SetID(id as String) as Boolean
Return values:
Success - TRUE
Error - FALSE

DLL32 FUNCTION SetID(ID AS LPSTR) AS WORD PASCAL LIB "\Ez\dll\POx.DLL"



Syntax :
Function SetTime( cur_time as Date) as Boolean
Return values:
Success - TRUE
Error - FALSE

DLL32 FUNCTION SetTime(cur_time AS Date) AS WORD PASCAL LIB "\Ez\dll\POx.DLL"



Syntax :
Function SetInterval(interval as Integer) as Boolean
Return values:
Success - TRUE
Error - FALSE

DLL32 FUNCTION SetInterval(interval AS LONG) AS WORD PASCAL LIB "\Ez\dll\POx.DLL"


Syntax :
Function GetData(data_array()) as integer
Return values:
Success - Number of Data lines
Error - 0

DLL32 FUNCTION GetData(data_array()) AS LONG PASCAL LIB "\Ez\dll\POx.DLL"

Thanks,
Jeff
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Jeff,

Try it this way:

Code: Select all

local hPOX := LoadLibrary( "\ez\dll\POX.DLL" )

DLL32 FUNCTION ... LIB hPOX

...

FreeLibrary( hPOX )
James
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Hi James,

When I try it that way and issue the Connect() command I get the following error:

Unrecoverable error 9003:
Too many recursive error handler calls
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Jeff,

I'm not experienced with DLL32 calls, but I notice other working calls (in my notes) use the FROM clause and the same name as the function with a trailing "A" so you might try:

DLL32 FUNCTION Connect ... FROM "ConnectA" LIB hPOX

If that doesn't work, hopefully someone else with DLL experience will help.

James
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Thanks for trying James ... Still no luck.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Adding External DLL Calls

Post by Enrico Maria Giordano »

Jeff Barnes wrote:Syntax :
Function Connect() as String
Return values:
Success - Port number
Error - Empty String

DLL32 FUNCTION Connect() AS LPSTR PASCAL LIB "\Ez\dll\POx.DLL"
As far as I know, you can't return a string from a DLL function. Do you have any VB samples?
Jeff Barnes wrote:Syntax :
Function SetID(id as String) as Boolean
Return values:
Success - TRUE
Error - FALSE

DLL32 FUNCTION SetID(ID AS LPSTR) AS WORD PASCAL LIB "\Ez\dll\POx.DLL"
AS BOOL instead of AS WORD.
Jeff Barnes wrote:DLL32 FUNCTION SetTime(cur_time AS Date) AS WORD PASCAL LIB "\Ez\dll\POx.DLL"
There's nothing like AS Date.
Jeff Barnes wrote:DLL32 FUNCTION GetData(data_array()) AS LONG PASCAL LIB "\Ez\dll\POx.DLL"
There's nothing like data_array() without data type.

EMG
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Hi Enrico,

Please check your email.


Thanks,
Jeff
Post Reply