modules with the same name in different packages

Mahe maheweb at web.de
Sat Sep 29 12:58:17 PDT 2007


Hi, 
I have a problem with 2 modules with the same name in different packages. It seems that one module obj overwrites the other.
Is there a possibility to solve that (except renaming the packages, because this would make packages useless)

Here some example source code. I compile it with:
dmd  main.d -odbin 
And get the error
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
bin\main.obj(main) 
 Error 42: Symbol Undefined _D4pack3mod4Mod27__ClassZ
--- errorlevel 1
#########################################
module pack.mod;

import tango.io.Console;

class Mod2
{
	public void foo()
	{
		Cout( "pack.mod" ).newline;
	}
}
##########################################
module mod;


import tango.io.Console;

class Mod1
{
	public void foo()
	{
		Cout( "mod" ).newline;
	}
}
##########################################
 module main;

import tango.io.Console;

import mod;
import pack.mod;

void main()
{
	Mod1 m1 = new Mod1;
	Mod2 m2 = new Mod2;
	
	m1.foo;
	m2.foo;
	
    Cout ("Hello" ).newline;
}

	





More information about the Digitalmars-d mailing list