FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to make a DLL
Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM

How to make a DLL

Posted: Mon Oct 08, 2007 08:26 AM
Antonio:
You could send just one string using a format similar like this:

Yes; that's what I was planning to do anyway

To do it, just include this function in your DLL:


Compiling with buildhd.bat I get an error:

Error E2141 dlltest 41: Declaration syntax error
*** 1 errors in Compile ***

just after #include <hbapiitm.h>. However, the DLL gets built. Is that normal?

Rafael
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How to make a DLL

Posted: Mon Oct 08, 2007 08:30 AM

Rafael,

Please add as the third include:

include <windows.h>

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM

How to make a DLL

Posted: Mon Oct 08, 2007 08:33 AM

Antonio:
It's compiling Ok now. Many thanks for your fast answer. I'll try it with VB and I'll let you know the results...
Rafael

Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM

How to make a DLL

Posted: Wed Oct 10, 2007 07:03 PM
Antonio has suggested a way to make my DLL accesible from Visual Basic that just completes the receipt to make DLLs callables from another language. Just add the following to the .prg:

long _export pascal TEST( char * cProcName, char * cParam )
{
   PHB_ITEM pItem = hb_itemPutC( NULL, cParam );

   hb_itemDoC( cProcName, 1, ( PHB_ITEM ) pItem, 0 );
   hb_itemRelease( pItem );

   return 0;
} 

and declare the DLL in VB as follows:

Declare Function TEST Lib "C:\Path\MyDll" (ByVal cProcName As String, ByVal cParam As String) As Long


Then, from VB5 just call the function as always:
n = TEST("TEST", "My_parameter")


I'm sure many people will find this info valuable. Thanks a lot, Antonio!

Rafael
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How to make a DLL

Posted: Wed Oct 10, 2007 07:07 PM

Rafael,

Glad to know it is working :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion