Note that there are some explanatory texts on larger screens.

plurals
  1. POMonoTouch System.EntryPointNotFoundException for a DLL
    primarykey
    data
    text
    <p>I'm trying to make a DLL with some native code functions that are accessed by my MonoTouch app. I followed the general methodology used by monotouch-bindings, where you:</p> <ul> <li>make an xcode project and put some native code in it</li> <li>build a static library (.a file) with xcodebuild</li> <li>run btouch with --link-with to make a .dll file</li> <li>add a reference to the .dll file in my MonoTouch app</li> </ul> <p>.. but whenever I try to use these functions in my app, I get System.EntryPointNotFoundException. Here's code for each thing I'm trying to do:</p> <p><strong>In the .cpp file:</strong></p> <pre><code>extern "C" { int SomeFunction(); } int SomeFunction() { ... } </code></pre> <p><strong>Command line to build the .a file</strong></p> <pre><code>xcodebuild -project MyStaticLibrary.xcodeproj -target MyStaticLibrary -sdk iphonesimulator -configuration Release clean build </code></pre> <p><strong>The .cs file (NativeBindings.cs) with the bindings</strong></p> <pre><code>public class MyStaticLibraryBindings { [ DllImport( "__Internal" ) ] public extern static int SomeFunction(); } </code></pre> <p><strong>AssemblyInfo.cs for the DLL</strong></p> <pre><code>using System; using MonoTouch.ObjCRuntime; [assembly: LinkWith ("libMyStaticLibrary.a", LinkTarget.Simulator | LinkTarget.ArmV7 | LinkTarget.ArmV7s, IsCxx = true, ForceLoad = true, Frameworks = "", WeakFrameworks = "")] </code></pre> <p><strong>The command line to build the .dll</strong></p> <pre><code>btouch -x=NativeBindings.cs AssemblyInfo.cs --out=NativeBindings.dll --link-with=libMyStaticLibrary.a,libMyStaticLibrary.a </code></pre> <p>.. the DLL builds fine, and my app sees the MyStaticLibraryBindings.SomeFunction function during compilation, but at runtime when I call it, I get System.EntryPointNotFoundException.</p> <p>I have verified that libMyStaticLibrary.a <em>does</em> contains SomeFunction:</p> <pre><code>~/build&gt; nm libMyStaticLibrary.a* 00000167 T _SomeFunction </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload