-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add DLL exports. #223
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
Add DLL exports. #223
Conversation
@theuni Comments? |
|
||
# if defined SECP256K1_STATIC | ||
# define SECP256K1_API | ||
# elif defined SECP256K1_DLL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake has a convention to add macro MyLibrary_EXPORTS
when building a DLL. Is it possible to rename SECP256K1_DLL
to SECP256K1_EXPORTS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly, the symbol is otherwise arbitrary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
I think this should be __attribute__ ((visibility ("hidden")))
in the SECP256K1_STATIC
case though, since it wouldn't need to be externally visible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea...
define SECP256K1_HELPER_DLL_EXPORT __declspec(dllexport)
else
if __GNUC__ >= 4
define SECP256K1_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
define SECP256K1_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
define SECP256K1_HELPER_STATIC __attribute__ ((visibility ("hidden")))
else
define SECP256K1_HELPER_DLL_IMPORT
define SECP256K1_HELPER_DLL_EXPORT
define SECP256K1_HELPER_STATIC
endif
endif
if defined SECP256K1_STATIC
define SECP256K1_API SECP256K1_HELPER_STATIC
elif defined SECP256K1_DLL
d29e19b
to
36daecf
Compare
# else | ||
# define SECP256K1_API SECP256K1_HELPER_DLL_IMPORT | ||
# endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above matches closely the GCC example (bottom of page). There is deviation in the public symbols SECP256K1_STATIC
and SECP256K1_EXPORTS
. The latter is modified for better CMake integration (see comment by @chfast). WRT the former I consider "static" more explicit than "local" and therefore better for publication.
Please take a look at #314 |
I prefer the readability of the gcc example layout, and the use of |
This defines SECP256K1_STATIC and SECP256K1_EXPORT, but they aren't being set anywhere? If in #314, in the non-SECP256K1_BUILD branch for windows, declspec(dllimport) is set rather than nothing, do we get the best of both worlds? |
I also think that this fails to set dllexport/import when compiling with MinGW? |
Superseded by #314. |
No description provided.