unrar.bmx
not sure if it works but it did compile and run your example.
to make unrar.a, run this batch file in the folder with unrar.dll. However, you need to have MinGW installed.
If still need a C++ wrapper, I'd be happy to write you one.
Strict Import "unrar.a" Const ERAR_END_ARCHIVE = 10 Const ERAR_NO_MEMORY = 11 Const ERAR_BAD_DATA = 12 Const ERAR_BAD_ARCHIVE = 13 Const ERAR_UNKNOWN_FORMAT = 14 Const ERAR_EOPEN = 15 Const ERAR_ECREATE = 16 Const ERAR_ECLOSE = 17 Const ERAR_EREAD = 18 Const ERAR_EWRITE = 19 Const ERAR_SMALL_BUF = 20 Const ERAR_UNKNOWN = 21 Const RAR_OM_LIST = 0 Const RAR_OM_EXTRACT = 1 Const RAR_SKIP = 0 Const RAR_TEST = 1 Const RAR_EXTRACT = 2 Const RAR_VOL_ASK = 0 Const RAR_VOL_NOTIFY = 1 Const RAR_DLL_VERSION = 4 Type RARHeaderData Field ArcName:Byte Ptr Field FileName:Byte Ptr Field Flags Field PackSize Field UnpSize Field HostOS Field FileCRC Field FileTime Field UnpVer Field Method_ Field FileAttr Field CmtBuf:Byte Ptr Field CmtBufSize Field CmtSize Field CmtState End Type Type RARHeaderDataEx Field ArcName[1024] Field ArcNameW[1024] Field FileName[1024] Field FileNameW[1024] Field Flags Field PackSize Field PackSizeHigh Field UnpSize Field UnpSizeHigh Field HostOS Field FileCRC Field FileTime Field UnpVer Field Method_ Field FileAttr Field CmtBuf:Byte Ptr Field CmtBufSize Field CmtSize Field CmtState Field Reserved[1024] End Type Type RAROpenArchiveData Field ArcName:Byte Ptr Field OpenMode Field OpenResult Field CmtBuf:Byte Ptr Field CmtBufSize Field CmtSize Field CmtState End Type Type RAROpenArchiveDataEx Field ArcName:Byte Ptr Field ArcNameW:Byte Ptr Field OpenMode Field OpenResult Field CmtBuf:Byte Ptr Field CmtBufSize Field CmtSize Field CmtState Field Flags Field Reserved[32] End Type Const UCM_CHANGEVOLUME=0,UCM_PROCESSDATA=1,UCM_NEEDPASSWORD=2 Extern Function RARCloseArchive(hArcData) Function RARGetDllVersion() Function RAROpenArchive(ArchiveData:RAROpenArchiveData) Function RAROpenArchiveEx(ArchiveData:RAROpenArchiveDataEx) Function RARProcessFile(hArcData,Operation,DestPath$z,DestName$z) Function RARProcessFileW(hArcData,Operation,DestPath$w,DestName$w) Function RARReadHeader(hArcData,HeaderData:RARHeaderData) Function RARReadHeaderEx(hArcData,HeaderData:RARHeaderDataEx) Function RARSetCallback(hArcData,Callback(msg,UserData,P1,P2),UserData) Function RARSetChangeVolProc(hArcData,ChangeVolProc(ArcName$z,Mode)) Function RARSetPassword(hArcData,Password$z) Function RARSetProcessDataProc(hArcData,ProcessDataProc(Addr$z,Size)) End Extern
not sure if it works but it did compile and run your example.
to make unrar.a, run this batch file in the folder with unrar.dll. However, you need to have MinGW installed.
pexports unrar.dll >unrar.def dlltool -d unrar.def -l unrar.a
If still need a C++ wrapper, I'd be happy to write you one.