I'm trying to interface to InfoZip's Zip32.dll from VB.Net code.
The DLL expects a structure with all its input parameters:
typedef struct {
int argc; // Count of files to zip
LPSTR lpszZipFN; // Archive file name
char **FNV; // file names to zip up. Think of this an argv
} ZCL, _far *LPZCL;
int WINAPI ZpArchive(LPZCL);
I was trying to implement this as a structure in VB.Net too, but either it
isn't possible or there's something wrong with my approach:
Private Structure ZipFileList
<MarshalAs(UnmanagedType.I4)> Dim nFiles As Integer
<MarshalAs(UnmanagedType.LPStr)> Dim ZipFile As String
<MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPStr)> _
Dim FileNames() As String
End Structure
I get an exception, "Can not marshal field FileNames of type ZipFileList:
This type can not be marshaled as a structure field."
Is there a way to make this work?
Lucvdv - 17 Nov 2005 13:01 GMT
> I'm trying to interface to InfoZip's Zip32.dll from VB.Net code.
>
> The DLL expects a structure with all its input parameters:
Quirky documentation: it doesn't expect a structure, it's just documented
in an awkward way. Apparently the correct declararion is
int WINAPI ZpArchive(int argc, LPSTR lpszZipFN, char **FNV);
So there's no need to store the array in a structure.