www.digitalmars.com         C & C++   DMDScript  

D - [Bug] Link error using private data

This one requires two files.  One defines a private
global symbol that is used in a template.  The
other file uses the template.  Here is the error:  

C:\Programming\D\bugs\err10>dmd inc.d err.d
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

Error 42: Symbol Undefined _D3inc3fooi
--- errorlevel 1

Here are the two files:

// inc.d
private int foo;

template Func()
void Func(int bar)
foo = bar;

// err.d
import inc;

int main(char[][] a)

return 0;
Jan 30 2004