Forum Xamarin.iOS

Reusing C++ DLL

Hi folks, just starting off with Xamarin and was wondering if the following options were technically possible/advisable. I've got a large bit of legacy C++ code inside a DLL that I want to reuse for an iOS app. In C# on a windows platform I could just reuse the DLL with P/Invoke. Can I do the same thing on iOS with Xamarin? The C++ DLL only contains STL calls and has no windows specific code inside it.


Jotharry Development


  • adamkempadamkemp USInsider, Developer Group Leader mod

    Yes, with one caveat: you need to make it a static library instead of a true dynamic library. The P/Invoke will use "__Internal" as the library name to find the symbol within the main program.

  • SKallSKall USMember ✭✭✭✭

    From what you write it seems like the DLL has C API in which case recompiling it to usable form is easy. If it is C++ then things get more complicated and you need to create a wrapper for it (C, ObjC, SWIG etc).

  • LarryGugerLarryGuger USMember

    Hi All,

    I am from the Microsoft C++ team and we are very interested in talking to developers that are incorporating C++ libraries into their Xamarin apps. If you are doing that I would be very excited if you would reach out to me directly. My email alias is larrygug. The domain is :-)


  • nanjumnanjum Member

    Hi Team,

    I too have same issue . I am holding the c++ dll and it is able to access from C# winform application using PINOVKE methodology. But now my requirement is to make the Android and IOS application to be use same c++ dll just like . Please let me know whether it is possible to have and any link to solve this problem.

    Thank you
    Naveed Anjum
    [email protected]

  • Hi LarryGuger,

    I am facing the same problem. I am having C++ dll and need to use it Xamarin forms for image conversion.
    Please let me know how to access it.
    I have just added the dll reference in my PCL project and access it's methods but facing another issue "reference to type bitmap claims it is defined in system.drawing but it could not be found".

    Please let me know some solution for the same.

    Thanks in advance
    Harshit Sharma
    [email protected]

Sign In or Register to comment.