Module wasmer_c_api::wasm_c_api::unstable::target_lexicon[][src]

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

wasmer_cpu_features_t

Unstable non-standard Wasmer-specific API to represent a set of CPU features.

wasmer_target_t

Unstable non-standard Wasmer-specific API to represent a triple + CPU features pair.

wasmer_triple_t

Unstable non-standard Wasmer-specific API to represent a target “triple”.

Functions

wasmer_cpu_features_add

Add a new CPU feature into the set represented by wasmer_cpu_features_t.

wasmer_cpu_features_delete

Delete a wasmer_cpu_features_t.

wasmer_cpu_features_new

Create a new wasmer_cpu_features_t.

wasmer_target_delete

Delete a wasmer_target_t.

wasmer_target_new

Creates a new wasmer_target_t.

wasmer_triple_delete

Delete a wasmer_triple_t.

wasmer_triple_new

Create a new wasmer_triple_t based on a triple string.

wasmer_triple_new_from_host

Create the wasmer_triple_t for the current host.