I have a dll that use this signature:
SFetch(cursor As Integer, pstruct As Any, size As Integer) As Integer
I can call it with simple variables like Integer
or more complexe one with custom types.
I want to create a function that would receive a parameter and send it to the dll, I tried different solutions but always have errors.
In all the cases, this is how I called it:
Dim val As Integer
...
.ExecuteRead val, LenB(val)
Public Sub ExecuteRead(ByVal pstruct, structSize As Integer)
SFetch1 c, pstruct, structSize
Returned Null
instead of a value
Public Sub ExecuteRead(pstruct, structSize As Integer)
SFetch1 c, pstruct, structSize
Returned Variable uses an Automation type not supported in Visual Basic
Public Sub ExecuteRead(pstruct As Variant, structSize As Integer)
SFetch1 c, pstruct, structSize
Returned Variable uses an Automation type not supported in Visual Basic
Public Sub ExecuteRead(pstruct As Object, structSize As Integer)
SFetch1 c, pstruct, structSize
Can't call the function ByRef argument type mismatch
Public Sub ExecuteRead(pstruct As Any, structSize As Integer)
Won't even compile, Syntax error
Just realized that I don't have an official answer so there it is.
This is the function declaration, including the call to my external function:
Public Sub ExecuteRead(ByVal pstruct As LongPtr, structSize As Integer)
SFetch1 dataCur, ByVal pstruct, structSize
There is how I call it from my main program:
obj.ExecuteRead VarPtr(returnGrp), LenB(returnGrp)