- Posts: 723
- Thank you received: 139
custom hal component failed to compile, undeclared (first use in this function)
- smc.collins
- Offline
- Platinum Member
-
Less
More
3 years 10 months ago - 3 years 10 months ago #259288
by smc.collins
custom hal component failed to compile, undeclared (first use in this function) was created by smc.collins
working on building a custom hal component for the cinturn turret, and despite the fact that " per the man pages" this appears to be properly declared at the top of the file, I am getting compilation errors that it is in fact not properly declared. I search for about 4hrs tonight looking for a clear cut answer on declaration of functions, variable etc and came back mostly empty handed. The documentation loosely eludes to c or python style declarations, and still everything appears to be correct regarding the contradictory statements that halcompile uses hal like naming and function calls, or c or python ??? which is it ? particularly when tied to pin/bin in/out variable term.. I see also that halcompile doesn't need to use a header file, which is nice, but do I need to use a C/python/hal ??? style init or function etc to create these instances ??? I have looked at multiple hal comp source files and I don't see the error here.
Sorry Rod, I thought I attached the right file. damn I really dislike the new windows file manager.
Sorry Rod, I thought I attached the right file. damn I really dislike the new windows file manager.
Last edit: 3 years 10 months ago by smc.collins.
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
3 years 10 months ago #259289
by rodw
Replied by rodw on topic custom hal component failed to compile, undeclared (first use in this function)
It would be helpful if you could share the .comp file 
The following user(s) said Thank You: smc.collins
Please Log in or Create an account to join the conversation.
- smc.collins
- Offline
- Platinum Member
-
Less
More
- Posts: 723
- Thank you received: 139
3 years 10 months ago - 3 years 10 months ago #259290
by smc.collins
fixed, and based on the code here Rod.
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
wiki.linuxcnc.org/uploads/oracchanger.compIt would be helpful if you could share the .comp file
fixed, and based on the code here Rod.
Last edit: 3 years 10 months ago by smc.collins.
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
3 years 10 months ago #259293
by rodw
Replied by rodw on topic custom hal component failed to compile, undeclared (first use in this function)
Great stuff!
My general thoughts on comp files is that they are being called from a timer interrupt (the servo thread) so they should be short and sharp and avoid loops. Let the Servo thread to the looping for you. Often you will see state machines (as you have) controlling the execution. Most features of C are supported. equates and enums, structs etc. You can call a function as normal. You can #include .H files. There are addidional extensions to create the man page before the code starts via python comments.
I personally think they are Linuxcnc's best kept secret. What other system lets you write custom code that is then treated as if its part of the Linuxcnc core? You can write pages of obfuscated hal or you can write a few lines of C...
My general thoughts on comp files is that they are being called from a timer interrupt (the servo thread) so they should be short and sharp and avoid loops. Let the Servo thread to the looping for you. Often you will see state machines (as you have) controlling the execution. Most features of C are supported. equates and enums, structs etc. You can call a function as normal. You can #include .H files. There are addidional extensions to create the man page before the code starts via python comments.
I personally think they are Linuxcnc's best kept secret. What other system lets you write custom code that is then treated as if its part of the Linuxcnc core? You can write pages of obfuscated hal or you can write a few lines of C...
The following user(s) said Thank You: smc.collins
Please Log in or Create an account to join the conversation.
- smc.collins
- Offline
- Platinum Member
-
Less
More
- Posts: 723
- Thank you received: 139
3 years 10 months ago - 3 years 10 months ago #259294
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
oh, my code isn't fixed, it's still broken afaict with declaration failures, and I don't really understand why. Unless you are hinting that I need to include my hal file, which, could I suppose act as a header???? little help here would be nice. I think the logic looks correct, but I could be very wrong
Last edit: 3 years 10 months ago by smc.collins.
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
3 years 10 months ago #259306
by rodw
Replied by rodw on topic custom hal component failed to compile, undeclared (first use in this function)
What is the error text and what line number does it refer
To?
To?
Please Log in or Create an account to join the conversation.
Time to create page: 2.217 seconds