-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMain.cs
More file actions
26 lines (21 loc) · 684 Bytes
/
Main.cs
File metadata and controls
26 lines (21 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
namespace MonoMacLoadLib
{
class MainClass
{
[DllImport ("EchoTest", EntryPoint="EchoInteger")]
public static extern int EchoInteger (int arg);
static void Main (string[] args)
{
// The current directly is expected to be passed in as arg[0] for this sample to work
string path = args[0] + "/bin/libEchoTest.dylib";
System.Console.WriteLine("Dylib Path:{0}", path);
IntPtr libPtr = Dlfcn.dlopen(path, 1);
System.Console.WriteLine("Pointer:{0}",libPtr);
int echoResults = EchoInteger(11);
System.Console.WriteLine("Echo Results:{0}",echoResults);
}
}
}