I tried to make standalone plugin and got few obstacles.
Linux 7zz i
doesn't see it, no matter where I put it (whether `Codecs' directory is in same directory or in `/usr/local/lib/p7zip/Codecs'), while windows 7z.exe i
sees it, no problem.
$ wine 7z.exe i
7-Zip 21.07 (x86) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26
Libs:
0 Z:\mnt\dev2\src\pak\7z_codec\src\7z2107_win\7z.dll
1 Z:\mnt\dev2\src\pak\7z_codec\src\7z2107_win\Codecs\ByteSwap8_Codec.dll
Codecs:
(...)
0 EDF 20302 Swap2
0 EDF 20304 Swap4
(...)
1 EDF 20308 Swap8
$ ./7zz i
7-Zip (z) 21.07 (x86) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26
Formats:
(...)
Codecs:
(...)
EDF 20302 Swap2
EDF 20304 Swap4
At first I thought it was because in linux `Codecs.def' doesn't work - gcc doesn't recognize it, in windows (mingw) it works but then I realized that Linux version doesn't look for plugins in Codecs directory. If that's the case, how to convince 7z to look for plugins in Codecs directory?
Second thing is - there seem to be some major change in plugins API in 7z-23. When I tried to compile my code (in attachment) I got whole bunch of errors (ibid.). Would you mind to explain what that is and put in README?
Can you please try building
7z
fromCPP/7zip/UI/Console/makefile.gcc
and7z.so
fromCPP/7zip/Bundles/Format7zF/makefile.gcc
, and use the compiled7z
binary instead of7zz
?Notice I use original source, only my plugin is separate, to not mess up with original source code tree. I have many, many reasons to not mix up with main source, like updates, for example. If main source changes, which it does quite often recently, I would have to edit that new source, edit new Makefiles and deal with changing tens, possibly hundreds of lines of code in case of complex plugins. I don't see a reason to do that if I can do it better.
There is nothing wrong with separate plugins. They can even be compiled separately and linked statically into executable at final linkage stage.
I don't see a benefits of doing what you propose.
7z + 7z.dll (+ plugins) - is main way to use 7-Zip in Windows.
But it could be more difficult to provide dynamic linking in linux.
That is why I used standalone
7zz
in linux as main binary.But if you need plugins in linux, then you must compile code with dynamic linking:
Last edit: Igor Pavlov 2023-11-08
7zz
- is standalone version. It doen't look plugins.7z
+7z.so
must work.About changes in API.
Old plugins for p7zip are not compatible with new 7-zip for linux because we have changed
IUnknown
:Also there is some additional function in
API
to getversion of plugin API and version of module:
Last edit: Igor Pavlov 2023-11-08
Understand. So the request is to put this in README; it's important change that noone knows about. At least something like
And put that in
LoadCodecs.cpp
rather than inMyWindows.h
, where would be reference to `LoadCodecs'.Would you mind to add such option, so 7zz would be compelled to look for plugins?
Or, shall I make a formal 'feature request'?
Last edit: Sam Tansy 2023-11-08
There is macro
that allows to get code compatible with old code.
And we must define that macro in
MyWindows.h
or inmakefile
.It changes all com interfaces everywhere in 7-zip (not only LoadCodecs.cpp).
So it was described in place where it can be defined -
MyWindows.h
.Did you read history.txt in source code ?
Last edit: Igor Pavlov 2023-11-08
I will test it.
Still in:
Could be reference to `MyWindows.h', like:
And in README reference to plugins, or at least where are they defined.
I did. I missed that somehow. I guess, because of 'Linux/MacOS'. I don't have Mac.
It states:
Does it mean that Windows plugins are still compatible between versions?
Tried to make it work with with v23 and my simple example of Swap8 seems to work. With more complex XorFilter from here I couldn't figure out how exactly these macros are suppose to work. AFAIU Z7_COM7F_IMF/Z7_COM7F_IMP replace STDMETHOD/STDMETHODIMP, and don't know what to do with MY_UNKNOWN_IMP2.
For both 7zip source is to be in `./7z2301' directory. It can be adjusted in scripts.
Last edit: Sam Tansy 2023-11-10
Just look 7-zip codecs in source code (old in new).
look in old source code of 7-zip the lines where
MY_UNKNOWN_IMP2
was used, and then look to what lines it was replaced.XorFilter v23 attached here as I couldn't attach two files.
Maybe that is good feature, but maybe is not good in some cases.
Maybe some users want the code that never use any plugins.
And it would not work by default without overtly specifying it. If someone makes an effort to specify an option they mean to use it.