DAR icon indicating copy to clipboard operation
DAR copied to clipboard

C binding for libdar?

Open piperun opened this issue 8 months ago • 7 comments

I've been eying this project for some time and been wanting to use it in Rust/Dart, unfortunately there's no C binding to more easily dig your teeth into. I noticed there is a python binding to my surprise but not C.

piperun avatar Nov 03 '23 18:11 piperun

correct, libdar is written in C++ and makes a big use of classes and objects. Though, one could argue that using an object is almost equivalent as adding a first argument (a pointer to the data-structure of the object, which can be an opaque one from API user point of view) to any method the class provides be converted to a C function...

If you are willing to set this up, let me know, I can guide you from the starting point (which code/branch to use from git) which part to focus on, up to what automatic/systematic naming could worth considering... Unfortunately, I have not free/personal time left for to do that alone, this is why I cannot add it to my todo list.

Edrusb avatar Nov 03 '23 20:11 Edrusb

Thank you for the reply! I will admit I'm not very well versed enough in C to form a proper C bindings, as I plan on investing time in learning rust in the near future that might be an option instead?

piperun avatar Nov 04 '23 16:11 piperun

Searching Internet, it seems complicated to call C++ routines from rust due to C++ name mangling... it is advised to pass through C, which is probably the reason why you were looking for C API to libdar...

The path seems less complicated to reach python code from Rust, though this may not be totally straight forward... but libdar provides a python API as you know...

my 2 cents...

Edrusb avatar Nov 04 '23 19:11 Edrusb

That is fair enough, I did find 2 projects that seem to have C bindings for libdar, but they are very old/incomplete: https://sourceforge.net/projects/darbinding/ And this is the binding DarGUI uses: https://sourceforge.net/p/dargui/code/HEAD/tree/libdargui/

piperun avatar Nov 04 '23 19:11 piperun

I'm sorry, I'd like to have more time to work on dar/libdar but I still have to pay my bills... and dar/libdar will stay free. So there are priorities and choices to take to match my available free time. C binding is not very demanded and while it does not seems very risky nor very complex to address (well, seen from far away...) it requires an important investment in time... something I have not for now... being busy some free software project...

Edrusb avatar Nov 04 '23 21:11 Edrusb

I'm not sure I follow, I only stated I found these. It was more of a look what I found rather than some demand, do apologize if it came out as such.

piperun avatar Nov 05 '23 02:11 piperun

This was unclear on my side what to do with these projects. Thanks for this feedback and no worries at all!

Edrusb avatar Nov 05 '23 10:11 Edrusb