DLL

Postby Antonio Linares » Mon Nov 20, 2006 9:34 am

Maurizio,

Try it this way:

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

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

Postby Enrico Maria Giordano » Mon Nov 20, 2006 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Nov 20, 2006 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Nov 20, 2006 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Nov 20, 2006 10:42 am

Enrico,

ops, I missed your command
regards, saludos

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

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Maurizio » Mon Nov 20, 2006 3: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
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Postby Enrico Maria Giordano » Mon Nov 20, 2006 5:40 pm

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

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

Postby Antonio Linares » Mon Nov 20, 2006 7:13 pm

Maurizio,

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

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

Postby Maurizio » 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
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Postby Antonio Linares » Tue Nov 21, 2006 11:01 am

Maurizio,

Remove these lines from your code:
Code: Select all  Expand view  RUN
// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Maurizio » Tue Nov 21, 2006 7:42 pm

:D 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
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

PreviousNext

Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 7 guests