Code: Select all
EnableExplicit
; These 4 procedures are Windows specific
;
; This procedure is called once, when the program loads the library
; for the first time. All init stuffs can be done here (but not DirectX init)
;
ProcedureDLL AttachProcess(Instance)
EndProcedure
; Called when the program release (free) the DLL
;
ProcedureDLL DetachProcess(Instance)
EndProcedure
; Both are called when a thread in a program call or release (free) the DLL
;
ProcedureDLL AttachThread(Instance)
EndProcedure
ProcedureDLL DetachThread(Instance)
EndProcedure
;
; Real code start here..
;
ProcedureDLL.l AddLong(num1.l, num2.l)
Protected Mysum.l
Mysum = num1 + num2
ProcedureReturn Mysum
EndProcedure
ProcedureDLL.f AddFloat(num1.f, num2.f)
Protected Mysum.f
Mysum = num1 + num2
ProcedureReturn Mysum
EndProcedure
ProcedureDLL.d AddDouble(num1.d, num2.d)
Protected Mysum.d
Mysum = num1 + num2
ProcedureReturn Mysum
EndProcedure
ProcedureDLL.i AddInt(num1.i, num2.i)
Protected Mysum.i
Mysum = num1 + num2
ProcedureReturn Mysum
EndProcedure
ProcedureDLL Mult2xRefFloat(*num1.Float, *num2.Float)
*num1\f = (*num1\f) * 2.0
*num2\f = (*num2\f) * 2.0
EndProcedure
ProcedureDLL Mult2xRefDouble(*num1.Double, *num2.Double)
*num1\d = (*num1\d) * 2.0
*num2\d = (*num2\d) * 2.0
EndProcedure
PROBLEM:
The following procedures FAIL: AddFloat, and AddDouble
AddFloat(3.14, 2.15) returns: 3.14 rather than 5.29
AddDouble(4.14, 5.15) returns: 4.14 rather than 9.29
The 3rd Party app Multicharts support staff say the problem is something in my PB DLL64.
I would really appreciate your experts insight. Have I done something wrong in the PB code? Thank you.