Mike McWhinney
2004-01-23 05:23:54 UTC
Hello,
I am converting some VB code into Delphi 5.0. I have
come across a construct such as:
Public Declare Function USBm_DeviceVID Lib "USBm.dll"
(ByVal device As Byte) As Integer
This would translate to the following equivalent in Delphi:
Function USBm_DeviceVID(device:Byte):smallInt; stdcall; external
'USBm.dll'
However when I get to the following:
Function USBm_RecentError Lib "USBm.dll"
(ByVal errorstring As String) As Integer
I would tend to write this as:
Function USBm_RecentError(errorstring:widestring):smallint; stdcall;
external 'USBm.dll'
However, in the function description it says that 'errorstring' is
returned
with the value of the error. Shouldn't ByVal be ByRef instead in the
previous function? Or should the Delphi function have a var
parameter.
I understand that string parameters are passed as pointers in VB.
Could someone please clear this up for me?
Thanks.
Mike McWhinney
I am converting some VB code into Delphi 5.0. I have
come across a construct such as:
Public Declare Function USBm_DeviceVID Lib "USBm.dll"
(ByVal device As Byte) As Integer
This would translate to the following equivalent in Delphi:
Function USBm_DeviceVID(device:Byte):smallInt; stdcall; external
'USBm.dll'
However when I get to the following:
Function USBm_RecentError Lib "USBm.dll"
(ByVal errorstring As String) As Integer
I would tend to write this as:
Function USBm_RecentError(errorstring:widestring):smallint; stdcall;
external 'USBm.dll'
However, in the function description it says that 'errorstring' is
returned
with the value of the error. Shouldn't ByVal be ByRef instead in the
previous function? Or should the Delphi function have a var
parameter.
I understand that string parameters are passed as pointers in VB.
Could someone please clear this up for me?
Thanks.
Mike McWhinney