WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.6% of users enabled 2FA.

test_ccall.c 2.11 KB
Newer Older
John Zhang's avatar
John Zhang committed
1 2 3 4 5 6 7 8 9

// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
    MuVM* mu_21;
    MuCtx* ctx_21;
    MuIRBuilder* bldr_21;
    MuID id_274;
    MuID id_275;
    MuID id_276;
    MuID id_277;
    MuID id_278;
    MuID id_279;
    MuID id_280;
    MuID id_281;
    MuID id_282;
    MuID id_283;
    MuID id_284;
    mu_21 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
    ctx_21 = mu_21->new_context(mu_21);
    bldr_21 = ctx_21->new_ir_builder(ctx_21);
    id_274 = bldr_21->gen_sym(bldr_21, "@i64");
    bldr_21->new_type_int(bldr_21, id_274, 64);
    id_275 = bldr_21->gen_sym(bldr_21, "@sig_i64_i64");
    bldr_21->new_funcsig(bldr_21, id_275, (MuTypeNode [1]){id_274}, 1, (MuTypeNode [1]){id_274}, 1);
    id_276 = bldr_21->gen_sym(bldr_21, "@fnpsig_i64_i64");
    bldr_21->new_type_ufuncptr(bldr_21, id_276, id_275);
    id_277 = bldr_21->gen_sym(bldr_21, "@c_fnc");
    bldr_21->new_const_extern(bldr_21, id_277, id_276, "fnc");
    id_278 = bldr_21->gen_sym(bldr_21, "@test_ccall");
    bldr_21->new_func(bldr_21, id_278, id_275);
    id_279 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1");
    id_280 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1.blk0");
    id_281 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1.blk0.k");
    id_282 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1.blk0.res");
    id_283 = bldr_21->gen_sym(bldr_21, NULL);
    bldr_21->new_ccall(bldr_21, id_283, (MuID [1]){id_282}, 1, MU_CC_DEFAULT, id_276, id_275, id_277, (MuVarNode [1]){id_281}, 1, MU_NO_ID, MU_NO_ID);
    id_284 = bldr_21->gen_sym(bldr_21, NULL);
    bldr_21->new_ret(bldr_21, id_284, (MuVarNode [1]){id_282}, 1);
    bldr_21->new_bb(bldr_21, id_280, (MuID [1]){id_281}, (MuTypeNode [1]){id_274}, 1, MU_NO_ID, (MuInstNode [2]){id_283, id_284}, 2);
    bldr_21->new_func_ver(bldr_21, id_279, id_278, (MuBBNode [1]){id_280}, 1);
    bldr_21->load(bldr_21);
    mu_21->compile_to_sharedlib(mu_21, "test_ccall.dylib", (char*[]){&"suite/test_ccall_fnc.c"}, 1);
John Zhang's avatar
John Zhang committed
49 50 51
    printf("%s\n", "test_ccall.dylib");
    return 0;
}