M
Marco Segurini
Hi,
Actually I am calling from VB some functions imported from a c++ dll.
Some of these functions require as parameter a pointer.
Example:
extern "C" int DllCall(int * pvInt, int iLen);
Now in VB I call this function passing a single element and/or an array.
To do this I define two alias function:
Public Declare Function DllCall_1 Lib "ImportDll.dll" Alias "DllCall"
(ByRef i as Integer, Optional ByVal nCount As Integer = 1) As Integer
Public Declare Function DllCall_n Lib "ImportDll.dll" Alias "DllCall"
(ByVal vInt() As Integer, ByVal nCount As Integer) As Integer
Sample of calling code:
Dim i as integer = 4
Call DllCall_1(i,1)
Dim vInt(10) as Integer
Call DllCall_n(vInt, 11)
The second parameter for 'DllCall_1' must be always 1
so I like to know if there is a way to declare the optional
parameter as 'immutable' so
Call DllCall_1(i) automatically becomes Call DllCall_1 (i,1)
and
Call DllCall_1 (i,1) -> build error
Call DllCall_1 (i,3) -> build error
Thanks.
Marco.
PS: I know that this can be reach with a wrapper function like
function WrapDllCall_1(ByRef i as Integer) as Integer
return DllCall(i,1)
End Function
Actually I am calling from VB some functions imported from a c++ dll.
Some of these functions require as parameter a pointer.
Example:
extern "C" int DllCall(int * pvInt, int iLen);
Now in VB I call this function passing a single element and/or an array.
To do this I define two alias function:
Public Declare Function DllCall_1 Lib "ImportDll.dll" Alias "DllCall"
(ByRef i as Integer, Optional ByVal nCount As Integer = 1) As Integer
Public Declare Function DllCall_n Lib "ImportDll.dll" Alias "DllCall"
(ByVal vInt() As Integer, ByVal nCount As Integer) As Integer
Sample of calling code:
Dim i as integer = 4
Call DllCall_1(i,1)
Dim vInt(10) as Integer
Call DllCall_n(vInt, 11)
The second parameter for 'DllCall_1' must be always 1
so I like to know if there is a way to declare the optional
parameter as 'immutable' so
Call DllCall_1(i) automatically becomes Call DllCall_1 (i,1)
and
Call DllCall_1 (i,1) -> build error
Call DllCall_1 (i,3) -> build error
Thanks.
Marco.
PS: I know that this can be reach with a wrapper function like
function WrapDllCall_1(ByRef i as Integer) as Integer
return DllCall(i,1)
End Function