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

Raspberry PI specific forum
d r h
New User
New User
Posts: 1
Joined: Sun Feb 12, 2023 2:00 am

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

Post 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
User avatar
idle
Always Here
Always Here
Posts: 5089
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post 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   
Post Reply