Skip to content

Conversation

evoskuil
Copy link
Contributor

No description provided.

@sipa
Copy link
Contributor

sipa commented Feb 24, 2015

@theuni Comments?

@gmaxwell gmaxwell added this to the initial release milestone Aug 31, 2015

# if defined SECP256K1_STATIC
# define SECP256K1_API
# elif defined SECP256K1_DLL
Copy link

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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

# else
# define SECP256K1_API SECP256K1_HELPER_DLL_IMPORT
# endif

Copy link
Contributor Author

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.

@gmaxwell
Copy link
Contributor

Please take a look at #314

@evoskuil
Copy link
Contributor Author

I prefer the readability of the gcc example layout, and the use of dllimport, but not a big deal in either case.

@chfast
Copy link

chfast commented Sep 23, 2015

@gmaxwell #314 looks like a subset of this one. With the except GCC visibility is not set to hidden by default here.

@sipa
Copy link
Contributor

sipa commented Sep 23, 2015

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?

@sipa
Copy link
Contributor

sipa commented Sep 23, 2015

I also think that this fails to set dllexport/import when compiling with MinGW?

@sipa
Copy link
Contributor

sipa commented Sep 25, 2015

Superseded by #314.

@sipa sipa closed this Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants