I'm in the feasibility stage of a project and I want to know if it is possible to create a library in C++ that can be utilized by both C# and Objective C.
Ideally I want to be able to create applications for the Mac OS and Windows environments without having to maintain two seperate code sets.
Your advice on this matter is greatly appreciated.
Yes, as long as you keep your code as pure c++ and don't use any OS specific API calls. There are loads of open source libraries like this, mostly written in c.
When you say library, are you talking about a static library or a DLL?
In the latter case, the main two possibilites for C# are:
- use PInvoke can call exported static class member functions or regular function
- write a mixed-mode wrapper assembly in C++/CLI
When it comes to Objective C, this is outside of my skillset. But this thread suggests that you can use C-linkage but not C++, due to name mangling. So you'd need to expose your C++ functionality via a C API.