[Gambas-user] Cannot find proprietary shared libraries.

Benoît Minisini g4mba5 at gmail.com
Tue Jun 5 14:10:56 CEST 2018


Le 05/06/2018 à 14:02, ML a écrit :
> Guys, need help accessing proprietary shared libs from Gambas (v3.11.2) 
> from PPA in Ubuntu 16.04 x64.
> 
> I've been given -after signing an NDA with a company- a couple of 
> development .so files.
> 
> I placed these .so files in a subfolder inside my home folder.
> I've put this path inside a .conf file, put this .conf file inside 
> /etc/ld.so.conf.d and ran ldconfig as superuser.
> I verified the libs and their location are in the cache by grepping the 
> output from ldconfig -p: They are both there.
> 
> But alas! Gambas cannot find them. I have this sample code (sorry, 
> cannot give real code details 'cos of the NDA):
> 
> Lib call declaration in a module (say it is called modLib):
> 
>    'The call name used is the actual call name, respecting 
> upper/lowercase, ie: no need for EXEC.
>    Public Extern SomeLib_GetVersion(versionStrPtr As Pointer) In "libName"
> 
> I also have a form with -appx- the following code:
> 
>    Public Sub Form_Open()
> 
>      Dim libVersion As String = String(128, " ")
>      Dim strPtr As Pointer = VarPtr(libVersion)
> 
>      Try modLibrary.SomeLib_GetVersion(strPtr)
>      If (Error.Code) Then
>        Message.Error(Error.Text)
>      End If
> 
>    End
> 
> When I call this from a form, I get the following error:
> 
> Cannot find dynamic library 'libName.so': libName.so: cannot open shared 
> object file: No such file or directory
> 
> Now, I've seen lib names with a trailing colon and (version?) number. I 
> don't know how or where can I get this info from, or if I need them.
> 
> How can I get Gambas able to find and use these .so files?
> Regarding these trailing ":<number>" in EXTERN declarations: How do I 
> find these out, and how do I know whether I need them or not?
> 

The name of the library is directly passed to the dlopen() function, and 
the error you get is the error returned by dlopen().

The "<number>" after the colon is just the version number of the shared 
library. You find it in the name of the shared library symbolic link. 
You have to specify it only if you have multiple versions of the same 
library, or if you requested a specific feature of a specific version of 
the library.

Regards,

-- 
Benoît Minisini


More information about the User mailing list