Page 1 of 1

OpenLibrary(0, "libc.so") returns 0

Posted: Sun Feb 12, 2023 2:24 am
by d r h
Hello everyone,

I've successfully installed pb6.00 and pb6.01 on a RasPi B+ running 64bit OS.

I'm planning to use pb primarily as a user interface accessing .so libraries.

Unfortunately, OpenLibrary(0, "libc.so") returns 0.

Is this due to my not knowing how to call .so files, or is it a real bug in the arm64 version of pb?

Thanks!

David

Re: OpenLibrary(0, "libc.so") returns 0

Posted: Tue Feb 14, 2023 12:59 am
by idle
On linux you can use ImportC with the same code to load static or shared objects
See here
viewtopic.php?t=51656

but in the case of libc you can do it like this as it's already linked to your code

Code: Select all

ImportC ""  ; "-lc"  ; the -l is for lib , it should find libc on PI and linux  
  calloc(elements.i,size.i) 
EndImport   

Structure vec2 
  x.d
  y.d 
EndStructure  

Structure aVec 
  v.vec2[0] 
EndStructure   

*p.aVec = calloc(10,SizeOf(vec2)) 

For a = 0 To 9 
  *p\v[a]\x = a * #PI 
  *p\v[a]\y = a * -#PI 
Next 

For a = 0 To 9 
  Debug *p\v[a]\x   
  Debug *p\v[a]\y 
Next