Using String value transfers from DLL Procedures
Posted: Thu May 07, 2015 8:57 am
Dear All,
I am trying to experiment with DLL creation and usage. Have got stuck on the problem below. Code of DLL and Test code sample given below. Seems that I am not able to get the logic of string value transfer from DLL.
DLL code is as below:
The testing program is as below:
I am getting a null value transferred to the test program. What am I doing wrong and why?
Will be very grateful for help on this. Thanks
I am trying to experiment with DLL creation and usage. Have got stuck on the problem below. Code of DLL and Test code sample given below. Seems that I am not able to get the logic of string value transfer from DLL.
DLL code is as below:
Code: Select all
ProcedureDLL AttachProcess(Instance.l)
Global HMS.s, mmm.i, nn.i, oo.d
EndProcedure
; Converts a decimal figure into the (hh:mm:ss.ss PM) mode in the 12 hour format. Output is in string format.
; Need to declare a string variable "HMS"
ProcedureDLL.s ConvertDecimaltoHMS12(DValue.d)
mm.i = Int(DValue)
If mm > 12
mmm.i = mm - 12
strm.s = "PM"
Else
mmm.i = mm
strm.s = "AM"
EndIf
dvm.d = (DValue - mm) * 60
nn.i = Int(dvm)
dvvm.d = (dvm - nn) * 60
oo.d = Int(dvvm)
HMS.s = Str(mmm) + ":" + Str(nn) + ":" + StrD(oo,2) + " " + strm
ProcedureReturn HMS
EndProcedure
Code: Select all
Global.s HMS
Global.d oo
Global.i mmm, nn
OpenLibrary(0, "CelestialCalculations.dll")
CallFunction(0, "ConvertDecimaltoHMS12", 17.3256)
Debug PeekS(*HMS)
Debug " "
CloseLibrary(0)
Repeat
Forever
Will be very grateful for help on this. Thanks