[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible/acceptable to create a component in Gambas that depends on a shared library?
[Thread Prev] | [Thread Next]
- Subject: Re: Is it possible/acceptable to create a component in Gambas that depends on a shared library?
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Fri, 6 Feb 2026 21:47:56 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Le 06/02/2026 à 21:16, Lee a écrit :
The recent thread on reading barcodes prompted me to revisit this idea.A while back I wrote a project that used "droidcam" and "zbarcam" to read barcodes using a smartphone. It works adequately, but managing each external process to make the user experience less cumbersome is more cumbersome in the code.It would be nice to be able to manage the reader directly from Gambas. But, it is even acceptable to create a component in Gambas that depends on a shared library?I see that gb.scanner relies on `scanimage`, but that is a command-line tool the existence of which is easily tested with System.Exist(). Also, I see that gb.openssl relies on the "openssl" library but that component is written in C and appears to statically link with the library.Is there a "proper" way to do what I am asking including relatively easily testing for the existence of the shared library to raise an error if it does not exist? Or is creating a component in Gambas that relies on a shared library (perhaps highly) discouraged if not prohibited?
It's not a good idea, because library are supposed to be used directly only by a compiled language.
The library provides interface files (C or C++ headers) for that, that are tested at compilation time through the 'pkg-config' file and version requirements or by just checking the availability of these interface files on the system, and adapting your code to the interface version.
If the interface library changes, your program usually does not compile anymore.
When you package a project using that library, you are supposed to create a dependency on the library package, with versions requirements, so that the interfaces used by the project at compile time match the interfaces provided by the library package at runtime.
How will you do that with a Gambas program at runtime only? -- Benoît Minisini.
| Is it possible/acceptable to create a component in Gambas that depends on a shared library? | Lee <t.lee.davidson@xxxxxxxxx> |