Hello,
I tried (again) with PB 4.01 (Linux) using the library libg2 (G2, writing for example direct postscript files). But with the open-function (here "g2_open_PS") I get no return-value, it's always "0".
deviceG2.l = CallCFunction(hlibg2, #g2_open_PS, OutFile$, #g2_A4, #g2_PS_port)
deviceG2 should be a device-value, but is 0.Outfile$ is written! No other operations possible, because ther deviceID is needed.
Maybe it is the way calling the routines, but the most tries with external libraries, I've trouble... ;-)
Look here:
; ------------------------------------------------------------------
; Small test using this fin eg2- Library from (libg2, libg2-dev)
; http://g2.sourceforge.net/
; libg2.so
;
;XIncludeFile "/home/mv/mvData/EigeneDateien/develop/purebasic/linux/include/g2/g2_ps.inc"
;something aut of "g2_inc"...
#g2_open_PS = "g2_open_PS"
#g2_close = "g2_close"
#g2_line = "g2_line"
#g2_rectangle = "g2_rectangle"
#g2_string = "g2_string"
#g2_A4 = 4
#g2_PS_port = 1
Global hlibg2.l, OutFile$
OutFile$ = "gs_print.ps"
Procedure g2_Init()
Shared hlibg2
hlibg2 = OpenLibrary(#PB_Any, "libg2.so")
EndProcedure
Procedure g2_Quit()
Shared hlibg2
CloseLibrary(hlibg2)
hlibg2 = 0
EndProcedure
g2_Init()
deviceG2.l = CallCFunction(hlibg2, #g2_open_PS, OutFile$, #g2_A4, #g2_PS_port)
; =>>> deviceID doesn't get a value (on C it is declared as "int"-type)
; function is successfull!
CallCFunction(hlibg2, #g2_line, deviceG2, 10.0, 10.0, 90.0, 200.0)
CallCFunction(hlibg2, #g2_string, deviceG2, 20.0, 20.0, "This is a test g2-PureBasic!")
CallCFunction(hlibg2, #g2_close, deviceG2)
g2_Quit()
;MessageRequester("Fertig!","Programm beendet!")
MessageRequester("Ready!","Program terminated!")
End
;-------------------------------------------------------------------------
Return value from a linux library (libg2.so)
Hello "walker",
sorry for answering so late. loading hlibg2 is successful, and it work's, because the first deviceG2 as a return value is "0" (next one is "1"...).
Damned... but no function for font-changing (or encoding for e.g. european characters), so this is no alternative way for Purebasic-printing under Linux.
Regards,
Markus
sorry for answering so late. loading hlibg2 is successful, and it work's, because the first deviceG2 as a return value is "0" (next one is "1"...).
Damned... but no function for font-changing (or encoding for e.g. european characters), so this is no alternative way for Purebasic-printing under Linux.
Regards,
Markus
-
- User
- Posts: 83
- Joined: Mon May 16, 2005 4:19 pm
- Location: St. Louis, MO
I was having that problem
Where you just get a 0 when opening a .so file. You can check the chatter back and forth on it (thread is under a request in my name --john duchek). I had given up and came back a few months later to find someone had left the correct answer(unfortunately I cannot remember his name right now).
he suggested I load "./filename" rather than "filename". It worked like a charm but I have no idea why. I understand that in Linux that tells it to use the current directory, but some of my .so files load without that (I guess they are in the path from somewhere else somehow.)
Anyway I can now list the libary, but still haven't figured out how to call and use the functions correctly.
John
he suggested I load "./filename" rather than "filename". It worked like a charm but I have no idea why. I understand that in Linux that tells it to use the current directory, but some of my .so files load without that (I guess they are in the path from somewhere else somehow.)
Anyway I can now list the libary, but still haven't figured out how to call and use the functions correctly.
John
John R. Duchek
St. Louis,MO
St. Louis,MO
It's a path issue.
I guess PB first looks in the PATH, this is the reason, why "filename" fails and "./filename" works.
Had this problem several times now. It's a strange behavior, because on some distros it works without "./" and on some others you always need it.
E.g.: Suse <> Ubuntu (I think it was something like this, but I'm not sure anymore)
I guess PB first looks in the PATH, this is the reason, why "filename" fails and "./filename" works.
Had this problem several times now. It's a strange behavior, because on some distros it works without "./" and on some others you always need it.
E.g.: Suse <> Ubuntu (I think it was something like this, but I'm not sure anymore)
cheers,
bembulak
bembulak
I have tested Libs on Ubuntu & OpenSuSe.
Having libs in:
works.
seeks the lib in the current directory.
Thalius
Having libs in:
Code: Select all
/usr/lib/
Code: Select all
./libname.so
Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone!
"
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone!
