4 ms·
You just need to do a bit of tiresome explicit declarations to statically link the code. For libraries with a large API that can be an annoyance.
by VHRanger 7y ago
You just need to do a bit of tiresome explicit declarations to statically link the code.
For libraries with a large API that can be an annoyance.
- e12e 7y agoSo, more than for using c++ with c++ -- in your build/link setup?
- elcritch 7y agoAFAICT, D requires the C++ types be exported, included any predefined template objects or functions. E.g. you can’t dynamically wrap `std::map<K,V>`, unless it’s already been instantiated in C++ library you’re linking. The same in Rust as well. See D Lang manual: Note that all instantiations used in D code must be provided by linking to C++ object code or shared libraries containing the instantiations. Whereas Nim is one of the few languageS that can dynamically wrap C++ template types into its type system. Maybe Zig can do it too? See Nim manual [2]. type StdMap {.importcpp: "std::map", header: "<map>".}[K, V] = object proc ... var x: StdMap[cint, cdouble] x[6] = 91.4 ... std::map<int, double> x; x[6] = 91.4; This makes it nice to wrap C++ libraries. :-) 1: https://dlang.org/spec/cpp_interface.html#cpp-templates https://dlang.org/spec/cpp_interface.html#cpp-templates 2: https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-objects https://nim-lang.org/docs/manual.html#importcpp-pragma-impor...