FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Adding External DLL Calls
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Adding External DLL Calls
Posted: Wed Aug 08, 2007 02:32 PM

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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Adding External DLL Calls
Posted: Wed Aug 08, 2007 02:58 PM
Jeff,

Try it this way:

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

DLL32 FUNCTION ... LIB hPOX

...

FreeLibrary( hPOX )


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Adding External DLL Calls
Posted: Wed Aug 08, 2007 03:10 PM

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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Adding External DLL Calls
Posted: Wed Aug 08, 2007 04:01 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Adding External DLL Calls
Posted: Wed Aug 08, 2007 04:31 PM

Thanks for trying James ... Still no luck.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Adding External DLL Calls
Posted: Wed Aug 08, 2007 06:32 PM
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
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Adding External DLL Calls
Posted: Wed Aug 08, 2007 06:56 PM

Hi Enrico,

Please check your email.

Thanks,
Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Adding External DLL Calls
Posted: Mon Nov 25, 2024 11:17 AM

Good Morning Enrico,

Have you ever had success to use these functions with DATE parameters?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Adding External DLL Calls
Posted: Mon Nov 25, 2024 01:14 PM

No, you can't. You have to write a wrapper.

Continue the discussion