alef-backend-java 0.16.4

Java (Panama FFM) backend for alef
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    private int {{ handle }}({{ sig_params }}) {
        try {
{% for param_unmarshal in param_unmarshal %}{{ param_unmarshal }}
{% endfor %}
{% if has_return %}            {{ return_type_str }} result = impl.{{ method_name }}({{ java_args }});
            String json = JSON.writeValueAsString(result);
            MemorySegment jsonCs = arena.allocateFrom(json);
            outResult.set(ValueLayout.ADDRESS, 0, jsonCs);
{% else %}            impl.{{ method_name }}({{ java_args }});
{% endif %}
            return 0;
        } catch (Throwable e) {
            writeError(outError, e);
            return 1;
        }
    }