halcompile shared lib

More
10 Mar 2021 10:25 - 10 Mar 2021 18:04 #201634 by udoS
halcompile shared lib was created by udoS
Hi to all

I'm running a soft-plc on RPi4-4G.
To interface with it I have a shared lib that reads/writes the tags from/to the plc ( and Qt ).
I have build a uspace module to Lcnc and it works fine. At 50 - 80 msec.
Now I like to interface with servo thread.
The question is how to compile the function with my shared lib.
What I did so far:
I have the .comp file. Include the header of the symbols.so : symbols.h
With sudo halcompile llx.comp I get the llx.c file.
With sudo halcompile --install llx.comp I get the llx.so inside /linuxcnc/components/
If I start Lcnc without using a lib function it starts up fine.
If I start up using a lib function I get error undefined symbol.

Where do I go from here ???
Last edit: 10 Mar 2021 18:04 by udoS.

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 16:22 #201661 by db1981
Replied by db1981 on topic halcompile shared lib
halcompile runs fine?

how is your running order of hal initialization? load and addf ...
May be the realtime module is loaded and initializied before the uspace module.

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 17:28 #201667 by udoS
Replied by udoS on topic halcompile shared lib
hi db1981

I don't think so;

#loadrt threads name1 = test-thread period1=10000
# Load plc-module llxplc3 into userspace
loadusr -W llxplc3

# Load plc-module llxplc into servo-thread
loadrt llxplc
addf llxplc.0 servo-thread

attached the .comp files
Attachments:

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 17:54 - 10 Mar 2021 18:11 #201669 by udoS
Replied by udoS on topic halcompile shared lib
as you see in llxplc.comp line 68 - 86 is commented out.
Like this Lcnc starts fine and timer tiks.
else I get an error at startup of Lcnc

I was reading this
www.forum.linuxcnc.org/24-hal-components...my-hal-comp?start=10
but did not get any further.

attached the error window;
Attachments:
Last edit: 10 Mar 2021 18:11 by udoS.

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 18:33 #201675 by db1981
Replied by db1981 on topic halcompile shared lib
hi,

i have no lcnc machine here,
can you post the compiled *.c file from output halcompile --compile (compiled with line 68-86 uncommented...), and the header file?

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 18:45 #201680 by udoS
Replied by udoS on topic halcompile shared lib
here it comes
Attachments:

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 18:47 - 10 Mar 2021 18:51 #201681 by udoS
Replied by udoS on topic halcompile shared lib
and here the llxplc.so

please rename to llxplx.so
Attachments:
Last edit: 10 Mar 2021 18:51 by udoS.

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 19:15 #201689 by db1981
Replied by db1981 on topic halcompile shared lib
linking work, include works, i not shure how the LL? libs got linked.

try an "LLSYMBOLS_API" in front of the function call LLsym_init(),
like in line 65.

all public functions got an LLSYMBOLS_API prefixed in the header file.

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 19:54 - 10 Mar 2021 19:56 #201691 by udoS
Replied by udoS on topic halcompile shared lib
attached the errors

One thing I like to mention: as you can see in the llxplc3.comp these calls are working fine for the uspace module.

by the way... thanks for looking into it. I'm really stuck with this.

best regards
udo
Attachments:
Last edit: 10 Mar 2021 19:56 by udoS.

Please Log in or Create an account to join the conversation.

More
10 Mar 2021 20:30 #201704 by db1981
Replied by db1981 on topic halcompile shared lib
oh, there's a macro.

okay, then coding seems right, my belly thinks it's an execution / startup thing....

for testing put the code line 69-86 in a if construction triggerd by an hal bit, and check if linuxcnc starts. after linuxcnc is fully running set the bit and check for crash....

i gues the rt's code is running before the all other modules finished initializing.

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum