On Wed, Sep 7, 2016 at 3:15 PM K leo <cnbiz...@gmail.com> wrote:

> So my question is how Cxx or CxxWrap can help me with these virtual
> functions?  Can I overload them in Julia?
>

Based on your description, I think the workflow for CxxWrap would be as
follows:
1. Write and wrap a top-level function that starts up the C++ framework
2. Override the virtual functions as needed, possibly passing Julia
function names using setter functions or in the class constructors
3. After loading the CxxWrap-generated module, set up the run from within
Julia, passing the names of the analytics functions as needed. When you
call the function written in 1, control is passed to the C++ framework.

Steps 1 and 2 would be completely in C++, step 3 completely in Julia.
CxxWrap has some provisions such as cxx_wrap::julia_call to make calling
Julia functions more friendly (using jl_call internally)

I think in Cxx you could do something similar, except that everything will
be in a .jl file.

Is the framework you use open source? It would help to see the concrete API.


> Furthermore, I saw simon rss asked the following question which I also
> would like to know.  Can anyone answer please?  Thanks.
>
> "Another thing I am not sure is that, when we embed code like
> "jl_eval_string" into C and compile it to a exe. When running this exe,
> will it call julia engine to evaluate it(this should have huge overhead) or
> will all be done directly at machine code level(no overhead)?"


It will call the Julia engine and evaluate following
http://docs.julialang.org/en/latest/devdocs/eval/. This means the julia
code will still be compiled using the JIT, but it will certainly not be
inlined into the C. Using jl_call is maybe one step better, but still
requires boxing the arguments. As Steven mentioned, the best way would be
to call the Julia function as a C function (I don't know how that is done,
I suppose it involves cfunction()).

Cheers,

Bart

Reply via email to