How to link a native c++ library...

"To Configure Xamarin.iOS To Link the Library, on the project options for your final executable (not the library itself, but the final program) you need to add in "iOS Build"'s Extra argument (these are part of your project options) the "-gcc_flags" option followed by a quoted string that contains all the extra libraries that are required for your program..."

However, I couldn't find where in the "iOS Build" section of Options I can add extra arguments. "iOS Build" has two tabs, General and Advanced, but neither one supports extra arguments.

Thanks in advance.

0

Posts

Thanks. I have a Xamarin project built for iOS by other developers. The project has a C++ library to the Native References folder and uses it in the code via DLLImport. However, it does not have any external compile options in the Additional Options section. Is the gcc link step missing here? But the code is working fine.

I'm not sure I fully understand what you are saying, but it's possible that the C# library that includes the native c++ library in the Native References is embedding the native library by using a LinkWithAttribute which has knowledge of how to natively link the c++ library when mtouch compiles the final native app binary.

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 microsoft.com. :-)