A question about libraries

Post

Posted
Rating:
#1 (In Topic #183)
Regular
bill-lancaster is in the usergroup ‘Regular’
Example:-
I have a library (LibDb) that deals with database functions.  Some of those functions need to call functions held in another library(LibXX).

Incorporating LibXX in LibDb causes an error :-

Code

"Cannot load LibXX: unable to load LibXX

Any advice would be welcome
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
vuott is in the usergroup ‘Regular’
 Hello,
3 questions:

  1. What are these external functions?
  2. Are you "translating" into Gambas a code already written in C ? If "yes", what ?
  3. Is it possible to have some Gambas code that reproduces that problem?

vuott

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
bill-lancaster is in the usergroup ‘Regular’
 Actually, it's not that complicated.
Make a simple runtime Gambas library MyLibA and another one, say MyLibB.
MyLibB has functions that I'd like to call from MyLibA.  The IDE allows MyLiB to be installed.  The error occurs at runtime.
I'm using these libraries locally, i.e. on the same PC
Thanks for the reply
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
stevedee is in the usergroup ‘Regular’
I think I know the problem that you describe. I have never been able to specify 2 dependent libraries.

I can only offer you a work-around, which is to include the functions from the second library into the first, and then recompile this 'super' library.

As an example, see my post: Captain Bodgit: RaspberryPi + wiringPi + Gambas + 16x2LCD module  …about half way down the page.

However, there must be a way to get this to work properly!
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
vuott is in the usergroup ‘Regular’

bill-lancaster said

Make a simple runtime Gambas library MyLibA and another one, say MyLibB.
Excuse me,
so we have a " MyLibA<COLOR color="#BF0000">.gambas</COLOR> " libray and a " MyLibB<COLOR color="#BF0000">.so</COLOR> " library ?

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#6
Regular
bill-lancaster is in the usergroup ‘Regular’
 No, all .gambas
Yes, the obvious way is to have only one library.
Online now: No Back to the top

Post

Posted
Rating:
#7
Regular
vuott is in the usergroup ‘Regular’
Well,
we have a main program and 2 .gambas libraries (libA and libB), containing Gambas code.

Main program has to call a function in libA, this function has call a function in libB.

In Project→Property→Libraries→Add of main program  you have to add both libraries (that is: libA and libB).

In this way, in your main program you can call only the function of libA (…that'll call the libB function).

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#8
Regular
bill-lancaster is in the usergroup ‘Regular’
 Yes, that's fine but if LibA  needs a function in LibB?
Online now: No Back to the top

Post

Posted
Rating:
#9
Regular
vuott is in the usergroup ‘Regular’

bill-lancaster said

but if LibA  needs a function in LibB?
You have to load LibB.gambas in LibA.gambas (they must reside in the same folder, in the same path), and then you have to load both .gambas libraries, libA.gambas and libB.gambas, in main program.

Obviously the codes of the .gambas libraries must be preceded by the key-word "Export", and the functions of the .gambas libraries must be declared as "Public".

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#10
Regular
bill-lancaster is in the usergroup ‘Regular’
Thanks vuott, that works.
Online now: No Back to the top
1 guest and 0 members have just viewed this.