![]() |
HELP: Compiling CLS libraries using GCC/MSVC
Hi, everyone
There is an add-on in FreeArc to compile cls libraries How do i add compression algorithm to the simple_codec.cpp file ? I am new to C/C++ programming. Anyone with knowledge of C, please help me out.. Code:
#include "cls.h" |
InnoSetup is make in delphi, but when it comes to C++ as an extension (*.dll) the ideal is to use MSVC since C++ Builder itself uses this compiler as a template to make it compatible. Although initially many avoid using it due to the dependencies of "vcredist (2005..2017)".
But if you develop an executable application could use mingw without problem, since it would only need to instantiate the initialization of it through command lines. |
Alright. But how do i add compression command to the above given code. Can u give me an example ? eg lolz -dto0 - dtd1 -dtm1
|
Quote:
Yes! |
Alright. But how do i add compression command under CLS_COMPRESS section? Eg: lolz -dto0 -dtd1
|
Do u mean like this ?
#include "cls.h" int ClsMain (int op, CLS_CALLBACK callback, void* instance) { switch(op) { case CLS_COMPRESS: { pzlib e -c200m -mc1023 } case CLS_DECOMPRESS: { char param[100]; callback(instance, CLS_GET_PARAMSTR, param, 100); // Get method parameters as single string const int BUFSIZE = 4096; char buf[BUFSIZE]; for (int len; (len=callback(instance, CLS_PARTIAL_READ, buf, BUFSIZE)) != 0; ) { if (len<0) return len; // Return errcode on error int result = callback(instance, CLS_FULL_WRITE, buf, len); if (result != len) return result<0? result : CLS_ERROR_WRITE; } return CLS_OK; } default: return CLS_ERROR_NOT_IMPLEMENTED; } } |
See this!
|
In which case which compiler will you use?
For example pzlib, ztool and xtools do not require cls-dll. If you are using mingw compile an executable example without necessarily using the cls-dll extension code. |
I wanted to create cls dll of pzlib for compression as the razor12911s dll did not work. I want to compress an archive using pzlib+lzma in freearc.
|
1 Attachment(s)
just use cmake(check attached archive), i used it with msys2 and msvc
PS: for using the boost in msvc, I have handwritten the paths in CMakeList.txt, you probably have to change it according to your environment, it works just fine with msys2(use pacman) also remember the arc is 32 bit so you have to use 32 bit environment for both msvc and msys2 in C++ you just need to inherit from ClsCompressor class and overwrite compress and decompress function f.e: Code:
class ClsLzhamCompressor : public ClsCompressor {Code:
extern "C" int __cdecl ClsMain(int operation, CLS_CALLBACK callback, |
| All times are GMT -7. The time now is 23:45. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com