API
Cxx.CxxCore.@cxx
— Macro@cxx expr
Evaluate the given expression as C++ code, punning on Julia syntax to avoid needing to wrap the C++ code in a string, as in cxx""
. The three basic features provided by @cxx
are:
- Static function calls:
@cxx mynamespace::func(args...)
- Member calls:
@cxx m->foo(args...)
, wherem
is aCppPtr
,CppRef
, orCppValue
- Value references:
@cxx foo
Unary *
inside a call, e.g. @cxx foo(*(a))
, is treated as a dereference of a
on the C++ side. Further, prefixing any value by &
takes the address of the given value.
In @cxx foo(*(a))
, the parentheses around a
are necessary since Julia syntax does not allow *
in the unary operator position otherwise.
Cxx.CxxCore.@cxx_str
— Macrocxx"C++ code"
Evaluate the given C++ code in the global scope. This can be used for declaring namespaces, classes, functions, global variables, etc. Unlike @cxx
, cxx""
does not require punning on Julia syntax, which means, e.g., that unary *
for pointers does not require parentheses.
Cxx.CxxCore.@icxx_str
— Macroicxx"C++ code"
Evaluate the given C++ code at the function scope. This should be used for calling C++ functions and performing computations.
Cxx.CxxCore.cxxinclude
— Functioncxxinclude([C::CxxInstance,] fname; isAngled=false)
Include the C++ file specified by fname
. This should be used when the path of the included file needs to be assembled programmatically as a Julia string. In all other situations, it is avisable to just use cxx"#include ..."
, which makes the intent clear and has the same directory resolution logic as C++.
Cxx.CxxCore.addHeaderDir
— FunctionaddHeaderDir([C::CxxInstance,] dirname; kind=C_User, isFramework=false)
Add a directory to the Clang #include
path. The keyword argument kind
specifies the kind of directory, and can be one of
C_User
(like passing-I
when compiling)C_System
(like-isystem
)C_ExternCSystem
(like-isystem
, but wrap inextern "C"
)
The isFramework
argument is the equivalent of passing the -F
option to Clang.
Cxx.CxxCore.defineMacro
— FunctiondefineMacro([C::CxxInstance,] name)
Define a C++ macro. Equivalent to cxx"#define $name"
.
Cxx.CxxCore.__current_compiler__
— Constant__current_compiler__
An instance of the Clang compiler current in use.