Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices;
- class Demo
- {
- static int Add(int left, int right) {
- return left + right;
- }
- [DllImport("MyLibrary.dll")]
- static extern void Foo(Func<int, int, int> func, bool bar);
- ...
- static void Main() {
- // call C++ with a delegate pointing to your method
- Foo(Add, true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment