- Configuring LinuxCNC
- HAL
- Custom halcomp with nested functions halcompile warning: implicit declaration of
Custom halcomp with nested functions halcompile warning: implicit declaration of
- NWE
- Offline
- Premium Member
-
Less
More
- Posts: 85
- Thank you received: 25
30 Dec 2025 20:48 #340739
by NWE
I get around C++ coding some, but this halcomp thing has me confused. I am trying to call several functions within the _ function. As far as I can tell, what I have should work, but when I halcompile it I get these annoying warnings. I know they are just warnings, but I wouldn't mind fixing them.
In other C projects I sometimes use headers, etc, but I'm confused how this works in halcompile.
I searched around some, but can't seem to find examples of how what I'm trying to do would be done in halcomp.
sudo halcompile --install beam_pullmax.comp
Compiling realtime beam_pullmax.c
beam_pullmax.comp: In function ‘_’:
beam_pullmax.comp:213:5: warning: implicit declaration of function ‘y_stop’ [-Wimplicit-function-declaration]
beam_pullmax.comp:241:6: warning: implicit declaration of function ‘y_down_fast’ [-Wimplicit-function-declaration]
beam_pullmax.comp:286:6: warning: implicit declaration of function ‘y_down_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:448:6: warning: implicit declaration of function ‘y_up_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:467:6: warning: implicit declaration of function ‘y_up_fast’ [-Wimplicit-function-declaration]
Linking beam_pullmax.so
cp beam_pullmax.so /usr/lib/linuxcnc/modules/
Ah Ha! I think I got it! Just include a header file like any old C program...
I guess I'll post anyway now that it is all typed up, in case it saves someone else time on a future project.
In other C projects I sometimes use headers, etc, but I'm confused how this works in halcompile.
I searched around some, but can't seem to find examples of how what I'm trying to do would be done in halcomp.
sudo halcompile --install beam_pullmax.comp
Compiling realtime beam_pullmax.c
beam_pullmax.comp: In function ‘_’:
beam_pullmax.comp:213:5: warning: implicit declaration of function ‘y_stop’ [-Wimplicit-function-declaration]
beam_pullmax.comp:241:6: warning: implicit declaration of function ‘y_down_fast’ [-Wimplicit-function-declaration]
beam_pullmax.comp:286:6: warning: implicit declaration of function ‘y_down_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:448:6: warning: implicit declaration of function ‘y_up_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:467:6: warning: implicit declaration of function ‘y_up_fast’ [-Wimplicit-function-declaration]
Linking beam_pullmax.so
cp beam_pullmax.so /usr/lib/linuxcnc/modules/
Ah Ha! I think I got it! Just include a header file like any old C program...
I guess I'll post anyway now that it is all typed up, in case it saves someone else time on a future project.
Please Log in or Create an account to join the conversation.
- NWE
- Offline
- Premium Member
-
Less
More
- Posts: 85
- Thank you received: 25
30 Dec 2025 22:49 #340749
by NWE
Replied by NWE on topic Custom halcomp with nested functions halcompile warning: implicit declaration of
Please Log in or Create an account to join the conversation.
- NWE
- Offline
- Premium Member
-
Less
More
- Posts: 85
- Thank you received: 25
30 Dec 2025 23:20 - 30 Dec 2025 23:34 #340750
by NWE
Replied by NWE on topic Custom halcomp with nested functions halcompile warning: implicit declaration of
Progress... so I found this:
forum.linuxcnc.org/38-general-linuxcnc-q...ponent-help?start=10
And that is just what I wish to do; it even works. So now all I need to do is figure out what I did different.
Attached a working example for reference.
Wow, this could get interesting, having to reference hal pins by pointer...
And that is just what I wish to do; it even works. So now all I need to do is figure out what I did different.
Attached a working example for reference.
Wow, this could get interesting, having to reference hal pins by pointer...
Last edit: 30 Dec 2025 23:34 by NWE.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- NWE
- Offline
- Premium Member
-
Less
More
- Posts: 85
- Thank you received: 25
09 Jan 2026 18:59 #341214
by NWE
Replied by NWE on topic Custom halcomp with nested functions halcompile warning: implicit declaration of
I found a seemingly cleaner way: I changed the function names to variables that I set to 1 or 0 at places in the program where I wanted to call the functions.
Then I moved my nested functions to the end of the halcomp and rewrote them into if() checking which variables are set.
My original purpose for functions had been to avoid having duplicate blocks of code each place I want to run that sequence. The if()'s at the end serve my need just as well.
Then I moved my nested functions to the end of the halcomp and rewrote them into if() checking which variables are set.
My original purpose for functions had been to avoid having duplicate blocks of code each place I want to run that sequence. The if()'s at the end serve my need just as well.
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- HAL
- Custom halcomp with nested functions halcompile warning: implicit declaration of
Time to create page: 0.075 seconds