| |
| Posted by frame in reply to CrazyMan | PermalinkReply |
|
frame
Posted in reply to CrazyMan
| On Thursday, 23 June 2022 at 08:12:32 UTC, CrazyMan wrote:
> I have a separate library and some template interface in it
interface IFoo(T)
{
void setValue(const(T) value);
}
But when using it in the main program, it throws a linking error. I found that you can make a sourceLibrary that copies the code instead of creating a binary. But with it, I also get a linking error, and at the same time it is no longer associated with my interface, but with a third-party dependency (bindbc.opengl)
What can I do to fix this?
This is insufficient information to help you.
-
Separate library could mean multiple things: a compiler library, a static linked binary, a SO/DLL binary.
-
What error is thrown?
-
Are you using extern declarations?
For a successful build the linker needs to get all symbols from any referenced source. The template isn't an actual symbol, it's just a information for the compiler to generate one. It says nothing about the symbol will be really generated or not. Also the linker needs to know if a library has to be used.
|