Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update C/C++ API (6.0.0) #4336

Open
stweil opened this issue Oct 28, 2024 · 12 comments
Open

Update C/C++ API (6.0.0) #4336

stweil opened this issue Oct 28, 2024 · 12 comments

Comments

@stweil
Copy link
Contributor

stweil commented Oct 28, 2024

Here we can discuss API changes which are incompatible and therefore postponed for a future release 6.

@stweil stweil added this to the 6.0.0 milestone Oct 28, 2024
@stweil stweil changed the title update c/c++ apis (6.0.0) Update C/C++ API (6.0.0) Oct 28, 2024
@stweil
Copy link
Contributor Author

stweil commented Oct 28, 2024

Should be drop the C API in release 6? Or later? Who is still using it?

@egorpugin
Copy link
Contributor

egorpugin commented Oct 28, 2024

+1 for dropping.

There are some users most likely, but they can take capi.h/cpp into their projects or maintain separate thin library of these two files.

@amitdo
Copy link
Collaborator

amitdo commented Oct 28, 2024

Who is still using it?

https://github.com/nguyenq/tess4j/

Most likely it is used by many companies internally.

@stweil
Copy link
Contributor Author

stweil commented Oct 28, 2024

I know from other software that it's possible to mark API functions in the header files as "deprecated", so anybody who uses them in a build process gets a warning message. So we might start adding such deprecation markers and then hopefully get more feedback.

@amitdo
Copy link
Collaborator

amitdo commented Oct 28, 2024

Previous talk about the C API:

#4074 (comment)

@zdenop
Copy link
Contributor

zdenop commented Oct 28, 2024

I still miss reasonable explanation of benefit for removing feature (C-API).
AFAIR contribution came from corporate environment for they want to use tesseract in pascal/Delphi(?). Also for new languages (e.g. rust) is easy to for with C library but problem with C++ (AFAIK).
If it is problem for somebody we can make it as optional feature (with default option to build it)

@egorpugin
Copy link
Contributor

AFAIR contribution came from corporate environment for they want to use tesseract in pascal/Delphi(?).

And they should maintain it.

We can mark capi as deprecated like @stweil said or unmaintained.

@egorpugin
Copy link
Contributor

We can also move out C API (two files) into separate tesseract_c library.

@jbarlow83
Copy link

I agree with removal. It's undocumented and in my limited experience, a bit of minefield for memory corruption bugs. pytesseract, tesseract-rs and ocrmypdf (my project) all use Tesseract in a subprocess. pytesseract used to have C API bindings but removed them many years ago.

To mark functions deprecated:

  • void myfunc() __attribute__ ((deprecated)); will mark a function as deprecated in GCC / LLVM.
  • for MSVC it's probably easiest to deprecate the whole compiler okay I'll be nice, __declspec(deprecated("** this is a deprecated function **"))

@amitdo
Copy link
Collaborator

amitdo commented Nov 1, 2024

@zdenop,

Do you have an objection to move the C API out of the main tesseract repo, to a new repo 'tesseract-capI' ?

@stweil
Copy link
Contributor Author

stweil commented Nov 1, 2024

Would this be reasonable as long as we work with major version 5?

@egorpugin
Copy link
Contributor

egorpugin commented Nov 1, 2024

It is better to create v5 branch and do some fixes into both v5 and master. And declare master as future 'v6' branch and do api changes here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants