FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC DLL
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Mon Nov 20, 2006 09:34 AM

Maurizio,

Try it this way:

c:\vce\bin\link /IMPLIB:rchglobe.dll /OUT:rchglobe.lib

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
DLL
Posted: Mon Nov 20, 2006 09:43 AM
Antonio Linares wrote:Maurizio,

Try it this way:

c:\vce\bin\link /IMPLIB:rchglobe.dll /OUT:rchglobe.lib


This is the result:

Microsoft (R) Incremental Linker Version 6.24.3077
Copyright (C) Microsoft Corporation. All rights reserved.

LINK : warning LNK4001: no object files specified; libraries used
LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
LINK : fatal error LNK1561: entry point must be defined


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Mon Nov 20, 2006 09:49 AM

The above was wrong. This should be the right way:

c:\vce\bin\lib /list:rchglobe.def rchglobe.dll

c:\vce\bin\lib /def:rchglobe.def /out:rchglobe.lib /machine:arm /subsystem:windowsce

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Mon Nov 20, 2006 09:53 AM

To create the DEF file, better use Borland:

impdef.exe rchglobe.def rchglobe.dll

and then use Microsoft lib as explained

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
DLL
Posted: Mon Nov 20, 2006 10:02 AM
Antonio Linares wrote:To create the DEF file, better use Borland:

impdef.exe rchglobe.def rchglobe.dll

and then use Microsoft lib as explained


Ok, the lib is created (but it was with my command too).

Maurizio please try it.

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Mon Nov 20, 2006 10:42 AM

Enrico,

ops, I missed your command

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
DLL
Posted: Mon Nov 20, 2006 11:24 AM
Antonio Linares wrote:Enrico,

ops, I missed your command


No problem. My command doesn't work anyway. The lib is created but errors out when is linked to the application.

EMG
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
DLL
Posted: Mon Nov 20, 2006 03:10 PM

Thank Antonio and Enrico

Now I have the LIB , and I cann link it without problem .

I try this function

pragma BEGINDUMP

include <hbapi.h>

HB_FUNC( RCHSENDDATA )
{
hb_retnl( RCHSendData( hb_parc( 1 ), hb_parc( 2 ) ) );
}

pragma ENDDUMP

But I have this error :

RCH.obj : error LNK2019: unresolved external symbol "int __cdecl RCHOpen(void)" (?RCHOpen@@YAHXZ) referenced in function "void __cdecl HB_FUN_RCHOpen(void)" (?HB_FUN_RCHOpen@@YAXXZ)
RCH.exe : fatal error LNK1120: 1 unresolved externals
//---------------------------------------------------------------------------
I Try this function

pragma BEGINDUMP

include <hbapi.h>

include <windows.h>

int RCHOpen( void );

HB_FUNC( RCHOpen )
{
hb_retnl( RCHOpen() );
}

pragma ENDDUMP

Creating library RCH.lib and object RCH.exp
RCH.obj : error LNK2019: unresolved external symbol "int __cdecl RCHOpen(void)" (?RCHOpen@@YAHXZ) referenced in function "void __cdecl HB_FUN_RCHOpen(void)" (?HB_FUN_RCHOpen@@YAXXZ)
RCH.exe : fatal error LNK1120: 1 unresolved externals

What is my error ?

Regards MAurizio

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
DLL
Posted: Mon Nov 20, 2006 05:40 PM

It seems a name-mangling problem as if the lib was compiled in C++.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Mon Nov 20, 2006 07:13 PM
Maurizio,

You have to include this in your code before your HB_FUNC()s:
extern "C" {
LONG RCHSendData( LPSTR, LPSTR );
LONG RCHOpen( void );
LONG RCHClose( void );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
DLL
Posted: Tue Nov 21, 2006 10:57 AM

Thank Antonio
Now I have this error

RCH.prg(317) : error C2556: 'int __cdecl RCHOpen(void)' : overloaded function di
ffers only by return type from 'long __cdecl RCHOpen(void)'
RCH.prg(309) : see declaration of 'RCHOpen'
RCH.prg(317) : error C2371: 'RCHOpen' : redefinition; different basic types
RCH.prg(309) : see declaration of 'RCHOpen'
RCH.prg(324) : error C2556: 'int __cdecl RCHOpen(void)' : overloaded function di
ffers only by return type from 'long __cdecl RCHOpen(void)'
RCH.prg(309) : see declaration of 'RCHOpen'
NMAKE : fatal error U1077: 'c:\vce\bin\clarm' : return code '0x2'


This is the source

pragma BEGINDUMP

include <Windows.h>

include <hbapi.h>

extern "C" {
LONG RCHSendData( LPSTR, LPSTR );
LONG RCHOpen( void );
LONG RCHClose( void );
}
HB_FUNC(RCHSENDDATA)
{
hb_retnl(RCHSendData(hb_parc(1),hb_parc(2)));
}

int RCHOpen( void );

HB_FUNC( RCHOpen )
{
hb_retnl( RCHOpen() );
}

int RCHOpen( void );
HB_FUNC( RCHOClose )
{
hb_retnl( RCHOpen() );
}

pragma ENDDUMP

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Tue Nov 21, 2006 11:01 AM
Maurizio,

Remove these lines from your code:
// int RCHOpen( void );  this!

HB_FUNC( RCHOpen ) 
{ 
hb_retnl( RCHOpen() ); 
} 

// int RCHOpen( void ); this!

HB_FUNC( RCHOClose ) 
{ 
hb_retnl( RCHOpen() ); 
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Tue Nov 21, 2006 11:03 AM

BTW,

This is wrong:

HB_FUNC( RCHOClose )
{
hb_retnl( RCHOpen() );
}

it should be

HB_FUNC( RCHClose )
{
hb_retnl( RCHClose() );
}

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
DLL
Posted: Tue Nov 21, 2006 11:05 AM

Finally, please use uppercase for names HB_FUNC ( ...Uppercase!... )

i.e.:

HB_FUNC( RCHCLOSE )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
DLL
Posted: Tue Nov 21, 2006 07:42 PM

Wow !!
Finally, thanks to your help the link to the LIB works.

Many, many thanks to Antonio and Enrico for your assistance.

The strange thing is that when I linked the LIB and inserted the code to
call the functions in the LIB, the calls to the DLL now works.
This might explain the reason why the calls to the DLL did not work before?

Maurizio

:D