rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
623 stars 113 forks source link

The Callbacks should have a "void*" data in order to pass the "this" pointer in a class usage #40

Closed fabri9532 closed 4 years ago

fabri9532 commented 4 years ago

Let me explain: When I use the library in a class, I need to declare tha Callback procedure as "static" member. With a static Callback procedure, I need to known from wich class object the call is made. So I need the "this" pointer to be passed to the Callback.

Modification example: Set Total callback: setTotalCallback( const TotalCallback &callback, void lpData ) TotalCallback: void(uint64_t total_size, void lpData)

rikyoz commented 4 years ago

I think that this situation can be solved without requiring the modification of the callbacks signatures. In fact, in this case there are two options for the callback function:

fabri9532 commented 4 years ago

Many thanks for the reply. The solution you proposed fully meets my needs.

Fabrizio.

rikyoz commented 4 years ago

You are welcome, glad to help!

Riccardo