Skip to content

[BUG] wasm_c_api doesn't work on non-Windows shared lib builds due to WASM_API_EXTERN evaluating blank #4850

@TaylorRichberger

Description

@TaylorRichberger

In wasm_export.h, WASM_RUNTIME_API_EXTERN defaults to __attribute__((visibility("default"))) on non-Windows platforms:

#ifndef WASM_RUNTIME_API_EXTERN
#if defined(_MSC_BUILD)
#if defined(COMPILING_WASM_RUNTIME_API)
#define WASM_RUNTIME_API_EXTERN __declspec(dllexport)
#else
#define WASM_RUNTIME_API_EXTERN __declspec(dllimport)
#endif
#elif defined(__GNUC__) || defined(__clang__)
#define WASM_RUNTIME_API_EXTERN __attribute__((visibility("default")))
#else
#define WASM_RUNTIME_API_EXTERN
#endif
#endif

But the same does not apply to WASM_API_EXTERN, used by the wasm_c_api:

#ifndef WASM_API_EXTERN
#if defined(_MSC_BUILD)
#if defined(COMPILING_WASM_RUNTIME_API)
#define WASM_API_EXTERN __declspec(dllexport)
#else
#define WASM_API_EXTERN __declspec(dllimport)
#endif
#else
#define WASM_API_EXTERN
#endif
#endif

The default configuration makes it impossible to use the wasm_c_api when WAMR is built as a dynamic library on non-windows platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions