Module wasmer_c_api::wasm_c_api::unstable::target_lexicon

source ·
Expand description

Unstable non-standard Wasmer-specific API that contains everything to create a target with a triple and CPU features.

This is useful for cross-compilation.

§Example

int main() {
    // Declare the target triple.
    wasmer_triple_t* triple;

    {
        wasm_name_t triple_name;
        wasm_name_new_from_string(&triple_name, "x86_64-apple-darwin");

        triple = wasmer_triple_new(&triple_name);

        wasm_name_delete(&triple_name);
    }

    assert(triple);

    // Declare the target CPU features.
    wasmer_cpu_features_t* cpu_features = wasmer_cpu_features_new();

    {
        wasm_name_t cpu_feature_name;
        wasm_name_new_from_string(&cpu_feature_name, "sse2");

        wasmer_cpu_features_add(cpu_features, &cpu_feature_name);

        wasm_name_delete(&cpu_feature_name);
    }

    assert(cpu_features);

    // Create the target!
    wasmer_target_t* target = wasmer_target_new(triple, cpu_features);
    assert(target);

    wasmer_target_delete(target);

    return 0;
}

Structs§

  • Unstable non-standard Wasmer-specific API to represent a set of CPU features.
  • Unstable non-standard Wasmer-specific API to represent a triple + CPU features pair.
  • Unstable non-standard Wasmer-specific API to represent a target “triple”.

Functions§