I have a template, that contains an import statement along with some other things, in a separate module. When I mixin this template somewhere, the import works and the compilation succeeds, but Rebuild does not include the relevant library on the linker command line.
For example, this mymixin.d module contains a snip of the template I'm using:
module mymixin;
template GLRendering()
{
import derelict.opengl.gl;
void renderSetup()
{
DerelictGL.load();
glShadeModel(GL_FLAT);
// ...
}
}
Here is a module with an entry point that uses the template:
module main;
import mymixin;
int main(char[][] args)
{
mixin GLRendering;
renderSetup();
// ...
return 0;
}
Along with this dsss.conf:
[]
name=bla
version=0.1
[main.d]
type=binary
target=bla
buildflags=-g -debug
I get the following output:
$ dsss build
Default prefix /usr/local is unwritable, using /home/shteef/d instead.
main.d => bla
+ /usr/local/bin/rebuild -Idsss_imports/ -I. -S./ -I/home/shteef/d/include/d -S/home/shteef/d/lib/ -I/usr/local/include/d -S/usr/local/lib -I/home/shteef/d/include/d -S/home/shteef/d/lib -oqdsss_objs -g -debug main.d -ofbla
gcc dsss_objs/_main.o dsss_objs/_mymixin.o -o bla -g -m32 -Xlinker --start-group -lphobos -Xlinker -L./ -Xlinker -L/home/shteef/d/lib/ -Xlinker -L/usr/local/lib -Xlinker -L/home/shteef/d/lib -Xlinker -L/usr/local/bin/../lib -Xlinker -L/usr/local/bin/../lib -lphobos -lpthread -lm
dsss_objs/_main.o:(.data+0x30): undefined reference to `_D8derelict6opengl2gl12__ModuleInfoZ'
dsss_objs/_main.o: In function `_D4main4mainFAAaZi17__T11GLRenderingZ11renderSetupMFZv':
/home/shteef/sources/MyGame/bla/mymixin.d:9: undefined reference to `_D8derelict6opengl2gl10DerelictGL4loadFAaZv'
/home/shteef/sources/MyGame/bla/mymixin.d:10: undefined reference to `_D8derelict6opengl7glfuncs12glShadeModelT8derelict6opengl7glfuncs14pfglShadeModel'
collect2: ld gaf exit-status 1 terug
--- errorlevel 1
Command /usr/local/bin/rebuild returned with code 65280, aborting.