Using a static library in another language

While testing compiling a static library using Mercury under Island (WIN64), I’m attempting to link with C++ as a test. I understand the Elements/Island/GC/RTL libraries need too be linked as well, however I’m unable to locate a rtl.lib file, just the FX file. Is it possible to static link all necessary code to a library itself during compilation/archiving?

There’s no rtl.lib because rtl.fx represents the APIs that are provided by the core OS, not any functionality we/Elements provides. So there should be nothing you need to link in for those (aside from the OS libraries or DLLs you already link from your C/C++ project, e.g. kernel32.dll and whatnot, on Windows).

Got it. I did notice API definitions within the file so that clarifies it.

Got it to compile, however I needed to rename the C++ entry point as there’s a main symbol already defined in Island.lib.

Interesting. maybe something we should have a look at, @ck?

Yep but at the cost of making other things harder. We don’t do distinct Island versions for dll vs exe vs static, which makes this a bit tricky.

2 Likes