"extern" template instantiation

Mathias LANG pro.mathias.lang at gmail.com
Tue Oct 22 09:55:32 PDT 2013


Hi everyone,
This is going to be a silly question.

I have the following files:
-- heavy.d --
import std.regex;
enum r = 
ctRegex!(r"^(\w+)\s+([a-zA-Z0-9/]+)\?a=(\w+)&b=(\w+)&c=(\w+)([&\D+=\w+)]*)&y=([0-9A-Fa-z]+)&z=([0-9A-Fa-z]+)$");

-- main.d --
import heavy;
void main() {}

-- test.d --
import heavy;
void test() {}

So I had a Makefile, and hit compile. *BAM*
1m40s latter, I switched from GDC to DMD, and updated my dmd to 
bleeding edge.
I though it might help because of: 
http://d.puremagic.com/issues/show_bug.cgi?id=11284

$ dmd
DMD64 D Compiler v2.064-devel-b12d171

But it didn't (time make):
dmd -debug  -c main.d -ofobjs/debug//main.o
dmd -debug  -c heavy.d -ofobjs/debug//heavy.o
dmd -debug  -c test.d -ofobjs/debug//test.o
	 - Linking bfake
real	0m19.893s
user	0m11.092s
sys	0m2.416s


With the import commented out (and make clean'ed):

dmd -debug  -c main.d -ofobjs/debug//main.o
dmd -debug  -c heavy.d -ofobjs/debug//heavy.o
dmd -debug  -c test.d -ofobjs/debug//test.o
	 - Linking bfake
real	0m5.636s
user	0m4.124s
sys	0m0.872s

So I thought of:
public alias typeof(ctRegex!(my-super-long-string)) APIRegex;

in a .di file, but I get a linker error, and it stills need to 
instantiate the template anyway.

Can anyone point me to the right way to do this ? Thanks!


More information about the Digitalmars-d-learn mailing list