DLL export Function Definition
---------------------------------------------------
_ Declspec (dllexport) int _ stdcall MyExportFunction (const char * p1, const char * p2, char * const out );
VBA processing (similar to VB.net processing)
Note that the [char *] type in C is equivalent to [ByRef aa As Byte] in VBA (or VB. NET ].
---------------------------------------------------
Private Declare Function fnc Lib "DLL path \ DLL name. dll "_
Alias "function name" (ByRef p1 As Byte, ByRef p2 As Byte, ByRef out As Byte) As Integer
Sub Test ()
Dim pUserID () As Byte
'String conversion to Byte array
Call ToBytes ("999999900", pUserID)
Dim pYYMMDD () As Byte
Call ToBytes ("091020", pYYMMDD)
Dim pPWD (50) As Byte
Aa = fnc (pUserID (0), pYYMMDD (0), pPWD (0 ))
Dim str As String
Str = StrConv (pPWD, vbUnicode)
MsgBox (str)
End Sub
'String conversion to Byte array
Private Sub ToBytes (ByRef src As String, ByRef dst () As Byte)
ReDim dst (Len (src ))
Dim I As Integer
For I = 1 To Len (src)
Dst (I-1) = Asc (Mid (src, I, 1 ))
Next
End Sub