External libraries

Ask about the individual Gambas components here.
User avatar
BruceSteers
Posts: 442
Joined: Thursday 23rd July 2020 5:20pm

External libraries

Post by BruceSteers » Friday 13th November 2020 7:16pm

Greetings all.

I'm trying to figure out how to use a library function but am clueless really :(

I want to use the XKeycodeToKeysym() command from the Xlib

I tried this..
Extern XKeycodeToKeysym(Disp As Object, code As Integer, Index As Integer) As String In "Xlib"

That does not work. says cannot find xlib.so

fumbling around in the dark here :(

Any clues would be appreciated.
Tia.
Bruce.
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
stevedee
Posts: 404
Joined: Monday 20th March 2017 6:06pm

Re: External libraries

Post by stevedee » Friday 13th November 2020 9:25pm

BruceSteers wrote:
Friday 13th November 2020 7:16pm
...I'm trying to figure out how to use a library function...
I think you are missing the Library declaration, take a look at my post: https://captainbodgit.blogspot.com/2019 ... aries.html

In the meantime I'll take a look at xlib

User avatar
stevedee
Posts: 404
Joined: Monday 20th March 2017 6:06pm

Re: External libraries

Post by stevedee » Friday 13th November 2020 9:49pm

Looks like the library you require is libx11: https://helpmanual.io/packages/apt/libx11-doc/

...we just got to figure out how to reference it

User avatar
BruceSteers
Posts: 442
Joined: Thursday 23rd July 2020 5:20pm

Re: External libraries

Post by BruceSteers » Friday 13th November 2020 10:12pm

Cheers Steve with that nudge i've found the library with using libX11 (capital X)

thank you , i can play with that now, just gotta work out how to pass the args like "Display"
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
stevedee
Posts: 404
Joined: Monday 20th March 2017 6:06pm

Re: External libraries

Post by stevedee » Friday 13th November 2020 10:34pm

BruceSteers wrote:
Friday 13th November 2020 10:12pm
...just gotta work out how to pass the args like "Display"
I don't know if you have already found this: http://gambaswiki.org/wiki/howto/extern

I think the Display argument is a pointer.

Good luck Bruce.

vuott
Posts: 69
Joined: Wednesday 05th April 2017 6:07pm
Location: European Union

Re: External libraries

Post by vuott » Friday 13th November 2020 11:25pm

stevedee wrote:
Friday 13th November 2020 10:34pm
I think the Display argument is a pointer.
Yes, he has to use a Pointer data type.


@BruceSteers
Here a few years ago I wrote some examples (text in italian) using the external functions of the X11 library in Gambas:

https://www.gambas-it.org/wiki/index.ph ... API_di_X11

User avatar
BruceSteers
Posts: 442
Joined: Thursday 23rd July 2020 5:20pm

Re: External libraries

Post by BruceSteers » Friday 13th November 2020 11:45pm

stevedee wrote:
Friday 13th November 2020 10:34pm
BruceSteers wrote:
Friday 13th November 2020 10:12pm
...just gotta work out how to pass the args like "Display"
I don't know if you have already found this: http://gambaswiki.org/wiki/howto/extern

I think the Display argument is a pointer.

Good luck Bruce.
Yes, cheers , been reading up where i can. heading into C world though , so much more complex than basic lol.

Definitely giving me a headache :-\

I may just blow it all out and make my app gtk only.
Key codes all seem fine and match keysymdef.h file on GTK , QT though , pah
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
stevedee
Posts: 404
Joined: Monday 20th March 2017 6:06pm

Re: External libraries

Post by stevedee » Saturday 14th November 2020 6:53am

BruceSteers wrote:
Friday 13th November 2020 11:45pm

....heading into C world though , so much more complex than basic...
Ideally, everyone should learn C.
Even if you never use it, having that background information is very useful when working with other languages and operating systems.
Definitely giving me a headache :-\

lol, try C++ for a full blown migraine!

User avatar
stevedee
Posts: 404
Joined: Monday 20th March 2017 6:06pm

Re: External libraries

Post by stevedee » Saturday 14th November 2020 7:11am

vuott wrote:
Friday 13th November 2020 11:25pm
...Here a few years ago I wrote some examples (text in italian) using the external functions of the X11 library in Gambas:

https://www.gambas-it.org/wiki/index.ph ... API_di_X11
These are great examples vuott, and what a brilliant Gambas wiki!

User avatar
BruceSteers
Posts: 442
Joined: Thursday 23rd July 2020 5:20pm

Re: External libraries

Post by BruceSteers » Saturday 14th November 2020 1:03pm

I gave up in the end lol, thanks for the help though , i tried.
I thought i was doing it right, i used the opendisplay command using Pointers then tried to use the function i wanted, then closedisplay.
Just got a segmentation 11 fault each time :(

But i found a work-around for now to get my macro recorder working (mostly) on QT.
I just have one little issue to deal with with a menu shortcut to play the macro.
On GTK if i hit F7 to play the macro and the macro calls a F3 (search) hit, it runs where it should.
On QT it seems the F3 hit does not get sent till all the macros have played out. (i'm guessing i'm locked in the KeyPress() function and the F3 hit does not function till out of the KeyPress function.) annoying as it does not happen on GTK just QT.

But thanks for the links guys , useful resources for me to look at if i try again :).
All the best
Bruce
Wishing well
Bruce

If at first you don't succeed , try it differently.

Post Reply