Using external library libg2

Linux specific forum
vekem
User
User
Posts: 12
Joined: Tue Jun 17, 2003 7:37 am
Location: Germany

Using external library libg2

Post by vekem »

Hello,

I'm trying to use (on Xandros Linux/Debian) the library libg2 (simple 2D graphics):

Writing a PBL-File for the DLL Importer (only the funkctions for a small exapmle program):

;-----------------------------
; PureBasic libg2 importer
;
libg2
g2_open_PS 3 ; int,enum,enum
g2_line 5 ; int,double,double,double,double,double
g2_close 1 ; int
;-----------------------------

With this a LIB-File in /purelibraries/linux is created.

Trying this example-code:

; ------------------------------------------------------------
;
; PureBasic - libg2 (Linux) example file
;
; ------------------------------------------------------------
;
Procedure g2_Output()
Protected d.l, file.s
d = g2_open_PS_("simple.ps", 4.0, 1.0) ;d=g2_open_PS("simple.ps", g2_A4, g2_PS_port)
g2_line_(d, 10.0, 10.0, 90.0, 90.0) ;g2_line(d, 10, 10, 90, 90)
g2_close_(d) ;g2_close(d);
EndProcedure


MessageRequester("libg2-example", "Testing.............................", 0)
g2_Output()

End
; ----------------------------------------------------------------------------

If one of the libg2-functions is used, the compiler doesn't make the program - nothing happens.

Does anybody knows why? Thanks!

Regards,
Markus
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

I have been over at http://g2.sourceforge.net and there it
seems like the library is static only..?!?!

Is the libname on your machine libg2.so or libg2.a?
If it's shared, you can try:

Code: Select all

If OpenLibrary(1,"libg2.so") = 0
  MessageRequester("Error", "Can't open library",0)
  End
Else
  MessageRequester("Info", "Library Open!",0)
EndIf
End
vekem
User
User
Posts: 12
Joined: Tue Jun 17, 2003 7:37 am
Location: Germany

Post by vekem »

Hi,

thanks for your help. On my Xandros Linux (Desktop 2.0) is running libg2.so. With Euphoria (www.rapideuphoria.com) the g2-Output goes well: creating Postscript-files to print...!

PureBasic seems not be able to handle double-variables. I tried the F64-library by freedimesion - can't compile programs. Also examples with structures dblout, making "half"-doubles (by preparing the paramter count in the pbl file for the importer) don't work.

Maybe we've to wait for PureBasic 4.0 using doubles without problems.

Or are there any other ideas?

Markus
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

No other ideas here :?

I'm trying to figure out what's working and not in PB for Linux
myself..
Like when I open a window and add a toolbar it ends up at the
bottom of the window!!?!
vekem
User
User
Posts: 12
Joined: Tue Jun 17, 2003 7:37 am
Location: Germany

Post by vekem »

Thanks olejr,

PB for Linux sometimes has a strange behaviour ;-)

For the Norwegian: last July I was sitting on Senja joining fjords and midnight sun, also with my laptop checking PB for Linux... no sleep ;-)

Markus
Post Reply