|
| 1 | +module CppCall |
| 2 | + |
| 3 | +using ClangCompiler |
| 4 | +using ClangCompiler: AbstractClangType, AbstractType, AbstractBuiltinType, AbstractRecordType |
| 5 | +using ClangCompiler: QualType, RecordType, EnumType, ElaboratedType, TypedefType |
| 6 | +using ClangCompiler: PointerType, LValueReferenceType, RValueReferenceType |
| 7 | +using ClangCompiler: FunctionNoProtoType, FunctionProtoType |
| 8 | +using ClangCompiler: TypeDecl, NamedDecl |
| 9 | +using ClangCompiler: get_type_ptr, get_qual_type, get_decl_type, get_pointee_type, desugar |
| 10 | +using ClangCompiler: get_return_type, get_params, get_param_num, get_param_type, get_integer_type |
| 11 | +using ClangCompiler: get_pointer_type |
| 12 | +using ClangCompiler: add_const, add_volatile, is_const, is_volatile |
| 13 | +using ClangCompiler: clty_to_jlty, jlty_to_clty, is_builtin_type |
| 14 | +using ClangCompiler: size_of |
| 15 | +using ClangCompiler: DeclFinder, get_decl, get_decls |
| 16 | + |
| 17 | +import ClangCompiler as CC |
| 18 | + |
| 19 | +using CppInterOp |
| 20 | +using CppInterOp: JLLEnvs |
| 21 | +using CppInterOp: create_interpreter, dispose |
| 22 | +using CppInterOp: addIncludePath, getptr |
| 23 | +using CppInterOp: CXScope |
| 24 | +using CppInterOp: invoke |
| 25 | +using CppInterOp: getFunctionSignature |
| 26 | + |
| 27 | +include("interpreter.jl") |
| 28 | +export initialize, is_valid, terminate |
| 29 | +export cppinclude, declare |
| 30 | + |
| 31 | +include("utils.jl") |
| 32 | + |
| 33 | +include("lookup.jl") |
| 34 | +export LookupKind, TypeLookup, FuncLookup, FuncOverloadingLookup, lookup |
| 35 | + |
| 36 | +include("types.jl") |
| 37 | +export CppType, CppFunc, CppPtr, CppRef, CppObject |
| 38 | + |
| 39 | +include("typemaps.jl") |
| 40 | +export cpptypemap |
| 41 | + |
| 42 | +include("convert.jl") |
| 43 | + |
| 44 | +include("macros.jl") |
| 45 | +export @declare_str, @include, @cppty_str, @cppobj, @qualty_str |
| 46 | + |
| 47 | +include("registry.jl") |
| 48 | +export register, get_instance, get_instance_id |
| 49 | + |
| 50 | +function __init__() |
| 51 | + try |
| 52 | + register(CppCall, initialize()) |
| 53 | + catch e |
| 54 | + @warn "failed to initialize the default interpreter: $e" |
| 55 | + end |
| 56 | + |
| 57 | + atexit() do |
| 58 | + for (_, I) in CPPCALL_INSTANCES |
| 59 | + terminate(I) |
| 60 | + end |
| 61 | + end |
| 62 | +end |
| 63 | + |
| 64 | +include("call.jl") |
| 65 | +export @fcall |
| 66 | + |
| 67 | +end # module |
0 commit comments