-
Notifications
You must be signed in to change notification settings - Fork 8k
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
API surface for Windows dll #2956
Comments
@cenit Hi, There are many functions in the Darknet with very simple and common names. So the best practice is to hide all functions, and Export only required API-functions.
So the best way is to add flag All available in the DLL/SO-library functions are here:
instead of Lines 752 to 755 in 099b71d
If you want to add another functions to the C-API, then just decalre them in the #ifdef OPENCV
// your functions
#endif // OPENCV C++ API functions should be added to |
ok understood. The project was built using the original pjreddie's darknet library, so it was using all and every symbol exported by that library. |
@cenit
Yes, we can. I think it is a good idea to Export: parse_network_cfg()
load_weights()
set_batch_network()
copy_image() But it is a bad idea to export: get_image_from_stream() - depends on OpenCV, also it is slower than my get_image_from_stream_resize(), why may repo works 1.5x - 2x faster of FullHD/4K video
what_time_is_it_now() - just timer that there is in any language and it is less accurate than my get_time_point()
fgetl() - just read line from C file-decrpitor, so it depends on C file-decrpitor In general, the best practice is to use
|
totally agree with you about best practices for C/C++ codebases and some necessary rework (breaking also) of the api surface here, especially if we want to really build a library out of darknet. Since you have an almost ideal knowledge of the codebase, I think you are in a perfect position to decide what works best, like what you just said about what to export and what not. We could write down a document (a GitHub project maybe?) with the necessary modifications you'd like to do on the codebase from this point of view and then I can start contributing on those points, referring point by point in each PR. What do you think? |
Do you mean something like Roadmap, with a more detailed description of what should be done? |
exactly. And each item solution a PR. |
I was trying to port a project that uses darklib (darknet as a library) to Windows, and I just realise it's not as easy as it should. This is because many functions exposed in header files are not exported in the dll.
So, for example, we are in a situation in which a
.so
file (shared lib) on linux, a.a
file (static lib) on linux and a.lib
(static lib) file on windows contains the full power of darknet through darklib (each and every function is available to call), while a.dll
(shared lib) on windows just expose functions marked withLIB_API
(very few).Is it possible to enhance the number of functions having this property? How was the decision based?
For example, for me, for now, just from a quick scan, at least these functions would be necessary:
this is just a quick list. The real question is "why limiting windows while letting other OSes use every function"? Shall we export everything? Shall we limit and remove from installed header files some functions in order to hide them on every OS?
The text was updated successfully, but these errors were encountered: