Had to call LoadLibrary
and use SetDllDirectory
for it to work, using DllImport
instead of LoadLibrary
does not work.
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void ingammaextern_(StringBuilder resulfilesparam);
{
var dllName = "SubsCalculator1.dll";
var interopPath = CreateDllFromResource(dllName);
var d1 = CreateDllFromResource("libgcc_s_dw2-1.dll");
var d2 = CreateDllFromResource("libgfortran-3.dll");
var d3 = CreateDllFromResource("libquadmath-0.dll");
string folderPath ="C:\folder\
SetDllDirectory(folderPath);
pDll = NativeMethods.LoadLibrary(interopPath);
}