- Posts: 19899
- Thank you received: 4655
custom hal component failed to compile, undeclared (first use in this function)
- andypugh
- Offline
- Moderator
-
Less
More
3 years 10 months ago #259773
by andypugh
Replied by andypugh on topic custom hal component failed to compile, undeclared (first use in this function)
You can't have a hyphen in a variable name in C.
my-pin looks like my (minus) pin to C, and it looks for variables "my" and "pin" and doesn't find them.
However, the convention (not well enforced) is that HAL pins should use - as the word separator, not _.
Halcompile handles this for you, but you need to remember that it is - above the ;; separator and _ below when referring to pin names.
Also confusing is that it is (index) to refer to members of a pin array, despite the fact that is is [index] to reference an array in C. Again this is a workaround in halcompile forced by C base code and macro syntax.
Halcompile does very clever things, but there are some assumptions in the C compilers that is can't work around quite as elegantly as one might wish.
my-pin looks like my (minus) pin to C, and it looks for variables "my" and "pin" and doesn't find them.
However, the convention (not well enforced) is that HAL pins should use - as the word separator, not _.
Halcompile handles this for you, but you need to remember that it is - above the ;; separator and _ below when referring to pin names.
Also confusing is that it is (index) to refer to members of a pin array, despite the fact that is is [index] to reference an array in C. Again this is a workaround in halcompile forced by C base code and macro syntax.
Halcompile does very clever things, but there are some assumptions in the C compilers that is can't work around quite as elegantly as one might wish.
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 #259848
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
I really think hal, should embrace a basic, like YAB or similar.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
-
Less
More
- Posts: 22011
- Thank you received: 7491
3 years 10 months ago #259850
by tommylight

Hal is the main reason i love LinuxCNC.
Replied by tommylight on topic custom hal component failed to compile, undeclared (first use in this function)
NoooooooI really think hal, should embrace a basic, like YAB or similar.
Hal is the main reason i love LinuxCNC.
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 #259858
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
C is a great language, but hal is already behaving like a Basic type language. it'd make more sense to have a basic type of syntax in hal. Back to my mess, I can get it to compile, but I still can't get it to work. If someone can explain why this doesn't work, I'd love to hear the explanation. latest source and config.
Last edit: 3 years 10 months ago by smc.collins.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
3 years 10 months ago #259910
by andypugh
The custom comps _have_ to be C files as they are compiled into Linux kernel modules and C is the only language allowed in the kernel.
Replied by andypugh on topic custom hal component failed to compile, undeclared (first use in this function)
HAL files can be Tcl files, if you want actual code in there.C is a great language, but hal is already behaving like a Basic type language. it'd make more sense to have a basic type of syntax in hal.
The custom comps _have_ to be C files as they are compiled into Linux kernel modules and C is the only language allowed in the kernel.
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 #259920
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
i got some motion today, sniffing out a logic problem but i think i might be on the correct path now.
any idea why iocontrol doesn't fetch the tool number from the component when homing ???
any idea why iocontrol doesn't fetch the tool number from the component when homing ???
Please Log in or Create an account to join the conversation.
Time to create page: 0.160 seconds