Forum Xamarin.iOS

Native linking failed with c++ library

I am trying to link with a static library built with XCode. I have added it under Native References, checked Force Load, Is C++, Smart Link. Still I get the error

"Native linking failed. Cannot find symbol _testfunc()".

The header looks like this:

#ifdef _cplusplus
extern "C" {
int testfunc(void);

The P/Invoke is simply
public static extern int testfunc();

If I compile the .a file as a C library, then it works fine (of course removing Is C++ option), but as soon as I change the implementation file to a cpp file in XCode I start to get the error above.

I am using Xamarin Forms but this is iOS related. On Android it just works.


Sign In or Register to comment.