Open fdncred opened 6 years ago
Unfortunately this was done by hand.
We did try to update the dll but it caused a lot of interop functions to be outdated as the original entrypoints changed. I do think that creating a script that reads through this header file and automatically create the native DllImports.cs file is worth investing some time in. It will be a lot easier to fix the actual c# classes when the compiler tells you where the mismatches are.
This was the easiest approach to build actual leptonica libraries that can work with Tesseract.net
I created a csharp console program that parses allheaders.h and creates a DllImport.cs file. It's not perfect but it's a good starting point. I started in powershell but eventually just got too complicated so I switched to c#. I'll share it here if you're interested in taking it and making it work.
This is the output. Like I said, it's not perfect and has some problems but you could probably easily fix the code to make it work right. Let me know if you're interested. DllImport.txt
Update: I just noticed the help wanted tag. So, here's the CSharp source. Program.cs.txt
I noticed today that this version is 4 versions old. Do you have some code that automatically generates a new DLLImport based on header files from Leptonica's C++ source? Or is there some other way to bring in all updated functions?