You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently all of the structs in the public API are only typedef'd, rather than both named and typedef'd. As such, the structs cannot be forward declared and instead using the struct name (typedef) in a header requires including the library headers. This can be problematic for projects which want to reduce the inclusion tree as much as possible.
For some context behind this request, in my MuSig2 PR to Bitcoin Core, since the secp256k1_musig_secnonce cannot be copied or serialized, I have to pass around a pointer to the object in various functions, so many headers need to include secp256k1_musig.h just for the struct's declaration. Including secp256k1_musig.h in those headers result in needing to directly link libsecp256k1 in several of build targets that did not previously require it. This issue seems like it can be avoided by forward declaring that (and other) struct, but in order to do so, it needs to be named in the libsecp headers.
My current workaround is to pass void * and then cast them as necessary but I don't really like doing that.
The text was updated successfully, but these errors were encountered:
Concept ACK, I guess. It shouldn't hurt us to turn every typedef struct { ... } secp256k1_foobar into typedef struct secp256k1_foobar_struct { ... } secp256k1_foobar?
Currently all of the structs in the public API are only typedef'd, rather than both named and typedef'd. As such, the structs cannot be forward declared and instead using the struct name (typedef) in a header requires including the library headers. This can be problematic for projects which want to reduce the inclusion tree as much as possible.
For some context behind this request, in my MuSig2 PR to Bitcoin Core, since the
secp256k1_musig_secnonce
cannot be copied or serialized, I have to pass around a pointer to the object in various functions, so many headers need to includesecp256k1_musig.h
just for the struct's declaration. Includingsecp256k1_musig.h
in those headers result in needing to directly link libsecp256k1 in several of build targets that did not previously require it. This issue seems like it can be avoided by forward declaring that (and other) struct, but in order to do so, it needs to be named in the libsecp headers.My current workaround is to pass
void *
and then cast them as necessary but I don't really like doing that.The text was updated successfully, but these errors were encountered: