how to add new .LIB into PureBASIC 4 ?

Just starting out? Need help? Post your questions and find answers here.
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

also, the lib is likely to use the cdecl calling convention
so try this

Code: Select all

ImportC "Basic2D.lib" 
  dbCls( RGBBackColor.l ) As "_dbCls"
  dbInk( RGBForeColor.l, RGBBackColor.l ) As "_dbInk"
  dbDot( X.l, Y.l ) As "_dbDot"
  dbBox( Left.l, Top.l, Right.l, Bottom.l ) As "_dbBox"
  dbLine( X1.l, Y1.l, X2.l, Y2.l ) "_dbLine"
  dbCircle( X.l, Y.l, Radius.l ) As "_dbCircle"
EndImport 
freddix
Enthusiast
Enthusiast
Posts: 100
Joined: Sun Feb 08, 2004 7:22 pm
Location: South France
Contact:

Post by freddix »

@Jack: thanks for the tips ... it helped find the problem
I must use the decorated form in 'as' :

but now I get error pointing to functions that are probably declared from within the LIB:

POLINK: error: Unresolved external symbol '?dbGetDirect3DDevice@@YAPAUIDirect3DDevice9@XZ'.
POLINK: error: Unresolved external symbol '__ftol2'.
POLINK: error: Unresolved external symbol '__fltused'.
POLINK: fatal error: 3 unresolved external(s)

Maybe I must import firstly the DLL that include the Direct3DDevice setup ?

Code: Select all

Import "Basic2D.lib" 
  dbCls( RGBBackColor.l ) As "?dbCLS@@YAXK@Z"
  dbInk( RGBForeColor.l, RGBBackColor.l ) As "?dbInk@@YAXKK@Z"
  dbDot( X.l, Y.l ) As "?dbDot@@YAXHH@Z"
  dbBox( Left.l, Top.l, Right.l, Bottom.l ) As "?dbBox@@YAXHHHH@Z"
  dbLine( X1.l, Y1.l, X2.l, Y2.l ) As "?dbLine@@YAXHHHH@Z"
  dbCircle( X.l, Y.l, Radius.l ) As "?dbCircle@@YAXHHH@Z"
 EndImport 

Procedure DgdkCLS( RGBColor.l )
  dbCls( RGBColor )
 EndProcedure

Procedure DgdkINK( ForeRGBColor.l, BackRGBColor.l )
  dbInk( ForeRGBColor, BackRGBColor )
 EndProcedure

Procedure DgdkDOT( X.l, Y.l )
  dbDot( X, Y )
 EndProcedure

Procedure DgdkBOX( Left.l, Top.l, Right.l, Bottom.l )
  dbBox( Left, Top, Right, Bottom )
 EndProcedure

Procedure DgdkLINE( X1.l, Y1.l, X2.l, Y2.l )
  dbLine( X1, Y1, X2, Y2 )
 EndProcedure

Procedure DgdkCIRCLE( X.l, Y.l, Radius.l )
  dbCircle( X, Y, Radius )
 EndProcedure
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

freddix wrote:Maybe I must import firstly the DLL that include the Direct3DDevice setup ?
looks that way, also add this and see if ftol2 and fltused errors go away.

Code: Select all

ImportC "MSVCRT.LIB" 
EndImport 
freddix
Enthusiast
Enthusiast
Posts: 100
Joined: Sun Feb 08, 2004 7:22 pm
Location: South France
Contact:

Post by freddix »

fltused error does no more appear but ftol2 is always here.
Post Reply