I am new in Julia so I hope I am not doing some kind of stupid mistake. However, what is wrong with this example?
using Cxx
cxx"""
#include <string>
std::string s( "123" );
"""
function testCxx()
std_str = @cxxnew std::string( "123" )
end
testCxx()
The output is as follows:
ERROR: LoadError: Got bad type information while compiling Cxx.CxxCore.CppNNS{Tuple{:std,:string}} (got String for argument 1)
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] check_args at /home/oberhuber/.julia/packages/Cxx/1RaOv/src/codegen.jl:447 [inlined]
[3] _cppcall(::Type, ::Type, ::Bool, ::Bool, ::Tuple{DataType}) at /home/oberhuber/.julia/packages/Cxx/1RaOv/src/codegen.jl:516
[4] #s37#41(::Any, ::Any, ::Any, ::Any) at /home/oberhuber/.julia/packages/Cxx/1RaOv/src/codegen.jl:849
[5] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:524
[6] testCxx() at /mnt/ssd/tmp/jtnl/cxx-std-string-test.jl:11
[7] top-level scope at /mnt/ssd/tmp/jtnl/cxx-std-string-test.jl:14
[8] include at ./boot.jl:328 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1105
[10] include(::Module, ::String) at ./Base.jl:31
[11] exec_options(::Base.JLOptions) at ./client.jl:287
[12] _start() at ./client.jl:460
in expression starting at /mnt/ssd/tmp/jtnl/cxx-std-string-test.jl:14
Hi,
I am new in Julia so I hope I am not doing some kind of stupid mistake. However, what is wrong with this example?
The output is as follows:
If I replace the line
with
it works as expected.