dll #.Net. , , . dumpbin.exe/EXPORTS, / EntryPoint dll. :
using System;
using System.Runtime.InteropServices;
namespace aviationLib
{
public struct MAGtype_GeoMagneticElements
{
public double Decl;
public double Incl;
public double F;
public double H;
public double X;
public double Y;
public double Z;
public double GV;
public double Decldot;
public double Incldot;
public double Fdot;
public double Hdot;
public double Xdot;
public double Ydot;
public double Zdot;
public double GVdot;
};
public class Declination
{
[DllImport("wmm.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "?GeoMagneticElements@@YAPAUMAGtype_GeoMagneticElements@@MHHMMM@Z")]
public static extern IntPtr GeoMagneticElements(float sdate, int igdgc, int units, float alt, float latitude, float longitude);
public MAGtype_GeoMagneticElements e;
public MAGtype_GeoMagneticElements MagDeclination(float decimalLat, float decimalLon)
{
try
{
String d = DateTime.Now.Year.ToString("D4") + '.' + DateTime.Now.Day.ToString("D1");
IntPtr pnt = GeoMagneticElements((float)Convert.ToDouble(d), 1, 3, 3000.0f, decimalLat, decimalLon);
e = Marshal.PtrToStructure<MAGtype_GeoMagneticElements>(pnt);
}
catch (System.EntryPointNotFoundException se)
{
Console.WriteLine(se.Message);
}
return e;
}
}
}
The meaning of the word should be the same for both managed and unmanaged, so if the dll is 32-bit, then .NET should also be.
source
share