Skip to content

secp256k1_context_static should be a const variable [edited] #1637

@purpleKarrot

Description

@purpleKarrot

Some language bindings have issues with exported variables. The static context is currently exported as a variable:

SECP256K1_API const secp256k1_context *secp256k1_context_static;

which is implemented as:

const secp256k1_context *secp256k1_context_static = &secp256k1_context_static_;

A more portable way would be to provide it through a function:

SECP256K1_API const secp256k1_context *secp256k1_context_static(void);

with implementation:

const secp256k1_context *secp256k1_context_static(void)
{
    return &secp256k1_context_static_;
}

PS: It is clear that changing the symbol into a function is a breaking change and therefore off the table. However, please consider adding a new symbol with the proposed implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions