I came across Unmanaged exports technique in this anwser on SO.
- I can manage myself to have simplest project working on SharpDevelop, albeit I don't have a good command of C#.
- I want to use the excellent Gavaghan.Geodesy (.Net/C#) library written by Mike Gavaghan.
- I want to avoid interoperability through COM.
- I definitely use Delphi. I only want to harness the library with it.
I managed to build the following code :
using System;
using System.Collections.Generic;
using System.Text;
using RGiesecke.DllExport;
namespace DelphiNET
{
internal static class UnmanagedExports
{
[DllExport("add", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
public static int add(int left, int right) {
return left + right;
}
}
}
I probed it with Delphi but was in vain.
I checked the output dll with a PE editor but It turned out to have no export data at all.
I miss something and I'm confused.
Edit:
Please - Help me fix the trouble
I managed to get this to work like this:
Note that the path to find the DLL is
bin\Debug\x86
. There is a DLL inbin\Debug
but this has no exports. Perhaps that's what you have been looking at.