Skip to content

static inline functions are not externally linkable #6400

@axos88

Description

@axos88

Summary

This and 15 other functions are defined as static inline in

static inline void *mbedtls_ssl_conf_get_user_data_p(

Obviously being inline they are a bit more performant this way, one less function call, one less branch, however they are also static which means they are not externally linkable. Because of this, if mbedtls is used from a language other than c / c++, where one cannot simply include the header file, these functions are not accessible, and in the "private fields" have to be accessed directly - which is totally doable since we're in C, without any real privacy -, but - I would guess - these are subject to change without notice, which means binary or source incompatibility even for patch releases, meaning upgrading mbedtls may be a can of worms.

My use case is calling mbedtls from rust, where bindings are auto-generated from the header files, however static inline wrappers are not supported because these are not externally linkable.

Please consider making these functions non-static (I think they can stay inline?), since they are not ones that would be called too often anyways.

System information

Mbed TLS version (number or commit id): 1b5c85c
Operating system and version: n/a
Configuration (if not default, please attach mbedtls_config.h): n/a
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): n/a
Additional environment information: n/a

Expected behavior

The compiled C library should have externally linkable symbols for these accessors.

Actual behavior

They are not.

Steps to reproduce

compile mbedtls as a library, look at the symbols, I guess.

Additional information

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-platformPortability layer and build scriptsenhancementhelp-wantedThis issue is not being actively worked on, but PRs welcome.size-sEstimated task size: small (~2d)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions