I have a C/C++ based simulation. I want to package Julia Code that loads a custom data-base type object and does some fast lookups and quick calculations so it is accessible to C. So I’m trying to set things up to make PackageCompiler happy. I want Julia to manage the loading of the database which will hang around as a Ref. The C will call various julia functions to set the conditions that pertain to the next lookup and then make a separate call to lookup and calculate the results. Then C will call again for the answer.
The problem I have is, the julia functions that load and initialize the database, need string arguments to find the files. I tried to setup the @ccallable macro by specifying the input would come in as a CString.
Base.@ccallable function julia_load_dB_jld2(jld2_filename::Cstring)::Cint blah blah blah end
But really that function needs jld2_filename to be a string.
I setup some unit tests to test this and did something like this to test it.
But Cstring I guess is just a pointer and julia’s String doesn’t know how to convert it.
So how do I get julia_load_dB_jld2 to be able to use this as a String?
I feel this is so basic it must be covered, but I find it nowhere. Do I just have the paradigm incorrect in my head.