Open ysoldak opened 1 year ago
When a C constant refers another C constant, it is not possible to use the former w/o explicitly referring the later too in Go code.
Reproducer, from bluetooth library https://github.com/tinygo-org/bluetooth/blob/release/error_sd.go#L15
Replace following line
case e >= C.NRF_ERROR_BASE_NUM && e < C.NRF_ERROR_SDM_BASE_NUM:
with
case e >= 0x0 && e < 0x1000:
And try compile, for example like this:
tinygo build -o test.hex -size=short -target=pca10040-s132v6 ./examples/advertisement
Error emitted:
# tinygo.org/x/bluetooth s132_nrf52_6.1.1/s132_nrf52_6.1.1_API/include/nrf_error.h:62:48: undefined: C.NRF_ERROR_BASE_NUM ...
Expected outcome: constants resolved correctly w/o need for referencing them explicitly in Go code.
@ysoldak is this still an issue with the latest release and/or dev branch?
I haven't changed anything related to CGo lately, so I'd guess yes.
When a C constant refers another C constant, it is not possible to use the former w/o explicitly referring the later too in Go code.
Reproducer, from bluetooth library https://github.com/tinygo-org/bluetooth/blob/release/error_sd.go#L15
Replace following line
with
And try compile, for example like this:
Error emitted:
Expected outcome: constants resolved correctly w/o need for referencing them explicitly in Go code.