[swift-users] C-function not found by linker

Rien Rien at Balancingrock.nl
Wed Jan 11 03:28:17 CST 2017


My project uses openSSL and that works fine.

I needed one specific function that cannot be accessed from Swift directly, so I created a C-file for that. (both .h and .c file)

The function is found during compilation.

But is then reported as “unused” and the linker reports “missing function”.

Any idea’s how this can be caused?

More info:

The .h file:

static void sslCtxSetTlsExtServernameCallback(SSL_CTX *ctx, int (*cb)(SSL *, int *, void *), void *arg);

The .c file:

static void sslCtxSetTlsExtServernameCallback(SSL_CTX *ctx, int (*cb)(SSL *, int *, void *), void *arg) {
    SSL_CTX_set_tlsext_servername_arg(ctx, arg);
    SSL_CTX_set_tlsext_servername_callback(ctx, cb);
}

Regards,
Rien

Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Swiftrien
Project: http://swiftfire.nl






More information about the swift-users mailing list