> However, I also just learned that you can't create a const pointer, including 
> const objects that contain ptr in their fields. If your struct is all values, 
> then it should be OK, you can take its addr at run time.

Yah that’d be a blocker. Most of these device bus structs take a pointer of 
some type. Making the valid C structs in Nim is easy but doing it at compile 
time isn’t for some of these device api’s.

Overall it’s probably simpler to make a generic API just take a device config 
object. Likely a ‘ref object’ so it’d be easy to do end-of-life cleanup if 
wanted.

But as pointed out by Araq above it seems that Nim api’s more by convention 
than explicit. So as long as the arguments and names were similar across 
projects people would know how to use them. So some platforms could use const’s 
and other objects, etc. 

Reply via email to