Hello Odin people.
I am new to Odin, and it is the first low-level language I’ve spent any real time with (never touched C/C++, few hours with Rust).
I am trying to build a C-compatible DLL so that I can use it in C/C++/via FFI.
Using C libraries in Odin seems to be a much hotter topic than the inverse, so I’ve struggled to find much online. I’m left with a couple of questions.
Parameter Defaults
If I write a procedure and wish to export it as part of a DLL usable in C/C++/via FFI, must I avoid using optional parameters with default values?
I assume they should not be used because of C’s lack of function overloading. I don’t know enough about either Odin or C to be confident in that assumption, though.
If they can be used, I’ve no idea what the resulting function signature(s) would look like.
I failed to consider this for my current project, which is fortunately tiny, and ended up using param defaults for many procedures. A re-write will be simple enough, but I’d like to know I’m not shooting myself in the foot by avoiding param defaults in this context.
Header File Generation
In my few hours using Rust, I did more or less the same thing I’m now trying to achieve with Odin. I found cbindgen, and it was very helpful for producing header files.
I’ve figured out enough to write my own header file for this little project, but I can see it being a potential headache for projects of size.
Is there a way to produce header files when building a library? If not, do any tools like cbindgen exist for Odin?
I have been able to successfully call one of my procedures from a C program, and any insight into the above would help me sort out the rest without being plagued by neurotic quantities of doubt.
If anyone could point me in the right direction, be it an explanation or a link to relevant resources, it would be greatly appreciated.
Thanks!