How to call a DLL ?

How to call a DLL ?

Postby Raymond Fischbach » Wed May 10, 2006 9:13 am

Hello,

I have to interface a DLL within a FWPPC program. Here follows the VB call to the function:

Code: Select all  Expand view
Public Declare Sub LatLon_WGS84_2_LT1 Lib "wdgps.dll" (ByVal dLat As Double, ByVal dLon As Double, ByRef dX As Double, ByRef dY As Double)


I have never done it so I don't know how to translate this into FWPPC.

Can someone help me ?

Thanks
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Re: How to call a DLL ?

Postby Enrico Maria Giordano » Wed May 10, 2006 9:38 am

Have a look at DLL command.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8398
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Wed May 10, 2006 9:54 am

Raymond,

You need to build a wrapper using C language as the parameters suply using DLL command is not ready yet. Please do a search on these forums for #pragma BEGINDUMP and you will find many samples.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41449
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Raymond Fischbach » Wed May 10, 2006 10:34 am

Thank you.

I have never done it. I have never programmed in C either.
Anyway, I will have to try it.
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Postby Antonio Linares » Fri May 12, 2006 9:55 am

Raymond,

First of all, you have to create an import library from "wdgps.dll", in two steps:

(impdef.exe is provided with free Borland C++, you may get it from ftp://ftpd.borland.com/download/bcppbui ... etools.exe)

1. impdef.exe wdgps.def wdgps.dll

that will create a wdgps.def file

2. lib.exe /OUT:wdgps.lib /DEF:wdgps.def

that will create a wdgps.lib

Please try it and check if you get the lib file.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41449
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Raymond Fischbach » Fri May 12, 2006 12:12 pm

Thank you Antonio,

I will do it
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Postby Raymond Fischbach » Thu May 18, 2006 6:23 pm

Hello Antonio,

I used Borland impdef.exe and then VCE lib.exe.
All seems to be ok and i have the wdgps_ce.lib file.

What should I do now ?

Thanks for your help,
Raymond
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Postby Antonio Linares » Fri May 19, 2006 9:51 am

Raymond,
Code: Select all  Expand view
#pragma BEGINDUMP

#include <hbapi.h>

HB_FUNC( CNVDEGTOXY )
{
   double dX = hb_parnd( 3 ), dY = hb_parnd( 4 );

   LatLon_WGS84_2_LT1( hb_parnd( 1 ), hb_parnd( 2 ), &dX, &dY );

   hb_stornd( dX, 3 );
   hb_stornd( dY, 4 );
}

#pragma ENDDUMP

Remember to link the library that you have created.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41449
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Raymond Fischbach » Fri May 19, 2006 11:13 am

Many thanks,

I will post the results after my tests.

Regards, Saludos,
Raymond
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Postby Raymond Fischbach » Thu Jun 01, 2006 10:53 am

It still doesn't work :(

Here is what i did:
- converted the DLL into a LIB following the directives from Antonio.
- added the wrapper into my code

- modified the Buildce.bat file to include the lib:
echo c:\FWPPC\GPS\UTM\wdgps_ce.lib >> msvc.tmp
The resulting msvc.tmp file contains the line:
c:\FWPPC\GPS\UTM\wdgps_ce.lib

- compile and link
I get the following errors:
Gps.prg(637) : error C2065: 'LatLon_WGS84_2_LT72' : undeclared identifier
Gps.prg(671) : error C2065: 'LatLon_WGS84_2_UTM_NAD83' : undeclared identifier

I found that I probably did the DLL - LIB conversion badly as I did not specified the processor type. Then I changed the call by adding the /MACHINE:ARM parameter to it.

But I get the same result.

What did I mis ?

Thanks for any help
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 1 guest