Does anyone have a working sample of a 64-bit DLL which works with MC64 that can do something very simple like simply adding two numbers? Any language is fine so that I can see the declarations. ex. C++, PureBasic, FreeBasic. Please only submit tested 64-bit DLL code. I can get it to work fine with 32-bit DLL but not with 64-bit version.
Here's a snippet of the code that FAILS in the 64-bit DLL (works fine when compiled as 32-bit with TS9):
Code: Select all
; Prototype for Adding two numbers
ProcedureDLL.double AddDouble(num1.double , num2.double )
Protected Mysum.double
Mysum = num1 + num2
ProcedureReturn Mysum
EndProcedure
Code: Select all
DefineDLLFunc: "DLLSample64.dll", LONG, "AddLong", LONG, LONG;
DefineDLLFunc: "DLLSample64.dll", float, "AddFloat", float, float;
DefineDLLFunc: "DLLSample64.dll", double, "AddDouble", double, double;
DefineDLLFunc: "DLLSample64.dll", int, "AddInt", int, int;
DefineDLLFunc: "DLLSample64.dll", void, "Mult2xRefFloat", LPFLOAT, LPFLOAT;
DefineDLLFunc: "DLLSample64.dll", void, "Mult2xRefDouble", LPDOUBLE, LPDOUBLE;
If Currentbar = 10 then begin
Print( "- - - ",currentdate:0:0, ", ", currentTime:0:0, " - - -");
// WORKS
Value1 = AddLong(5,7);
Print("AddLong performs 5+7=12, Actual = ",value1);
// FAILS
Value1 = AddFloat(float 3.14,float 2.15);
Print("AddFloat performs 3.14+2.15=5.29, Actual = ",Value1);
// FAILS
Value1 = AddDouble(4.14, 5.15);
Print("AddDouble performs 4.14+5.15=9.29, Actual = ",Value1);
// WORKS
Value1 = AddInt(4,3);
Print("AddInt performs 4+3=7, Actual = ",value1);
// FAILS
Value1 = 5.6;
Value2 = 6.7;
Mult2xRefFloat(&Value1, &Value2);
Print("Mult2xRefFloat performs 2 x Value2=11.2, 2 x Value3=13.4, Actual= ",Value1,", ", Value2);
// WORKS
Value1 = 1.2;
Value2 = 3.3;
Mult2xRefDouble(&Value1 , &Value2 );
Print("Mult2xRefDouble performs 2 x Value2=2.4, 2 x Value3=6.6, Actual= ",Value1 ,", ", Value2 );
end;