<div dir="ltr">Hello,<div><br></div><div>I'm scavenging parts of libc++ as a standard library for some C++ jitting using clang+llvm ORC.</div><div><br></div><div>I precompile the required sources of libc++ plus my runtimes, emitting that as LLVM IR. The C++ "script" gets compiled as another translation unit, and they are added as two llvm::Modules into a IRCompileLayer. Thus, I don't link to any system runtimes.</div><div><br></div><div>Some types from libc++ create issues though, like std::string. I get unresolved externals for member functions like string::data() and the destructor. Looking at the IR dump of the user translation unit, functions like string::data are only declared, and marked dllimport (and compiling the libc++ source doesn't emit the definitions, either).</div><div><br></div><div>Any idea what gives? I looked at the attributes attached to std::basic_string, which seems to be a mixture of _LIBCPP_INLINE_VISIBILITY for the member functions, _LIBCPP_TEMPLATE_VIS on the class itself, and _LIBCPP_EXTERN_TEMPLATE + _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS on the common base class. I guess a mixture of these ends up defining the import/export traits of std types in libc++, but I don't really know how to control them, so I was hoping someone could give some quick pointers.</div><div><br></div><div>In my case,
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">_LIBCPP_INLINE_VISIBILITY<span> equals the always_inline attribute, so why clang would emit dllimports for inline visible methods and not just inline them I don't know, I'm starting to think types contained inside libc++ system headers are treated in a special way depending on flags I don't know.<br><br>Again, any hints would be appreciated :)<br><br>Regards, Janus</span></span></div></div>