iotivity-lite
iotivity-lite copied to clipboard
Export functions through DLL for other libraries to use
I'm not entirely sure how this is meant to work, but if I want to interop with the API from C#, I had to do the following:
- Compile as a dll (please provide binaries :))
- Add
__declspec(dllexport)
to functions, to ensure they're exported
Could these things be done in the project itself, so that I and others can interop with the produced binary?
Yes, that can be done in the project, but in a portable way. This is often achieved with a pre-processor macro like this one: https://github.com/zeromq/libzmq/blob/master/include/zmq.h#L62
Yes, exactly. I had a hard time adding these locally, as there are so many methods, and I couldn't quickly identify which ones should be exported. It would have been easier if all public methods had been defined using a macro, so I could modify that and thereby add the export declaration.
A macro could be helpful also to ensure a consistent API surface, such as the oc_
prefix.