www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Problems with delete

reply "Bruno A. Costa" <bruno codata.com.br> writes:
Hi,

I was playing a bit with templates in D and found the following link error
when trying to compile.

$ dmd list.d
gcc list.o -o list -lphobos -lpthread -lm
list.o(.gnu.linkonce.t_D11collections4list6List_i4List5_dtorFZv+0x35): In
function `_D11collections4list6List_i4List5_dtorFZv':
: undefined reference to `_d_delmemory'
collect2: ld returned 1 exit status
--- errorlevel 256

The problem is related to a delete statement inside the destructor of a
class template. I am trying to manually clean the resources used by a
dynamically linked list (yes, I know the GC can do it for me). The problem
occurs in line 72 (code atached).

If I remove the code inside the destructor, the testing program compile,
link and run fine.

Thanks in advance,

Bruno.
Jun 23 2004
parent "Bruno A. Costa" <bruno codata.com.br> writes:
Sorry, the problem is in line 102.

Bruno A. Costa wrote:

 Hi,
 
 I was playing a bit with templates in D and found the following link error
 when trying to compile.
 
 $ dmd list.d
 gcc list.o -o list -lphobos -lpthread -lm
 list.o(.gnu.linkonce.t_D11collections4list6List_i4List5_dtorFZv+0x35): In
 function `_D11collections4list6List_i4List5_dtorFZv':
 : undefined reference to `_d_delmemory'
 collect2: ld returned 1 exit status
 --- errorlevel 256
 
 The problem is related to a delete statement inside the destructor of a
 class template. I am trying to manually clean the resources used by a
 dynamically linked list (yes, I know the GC can do it for me). The problem
 occurs in line 72 (code atached).
 
 If I remove the code inside the destructor, the testing program compile,
 link and run fine.
 
 Thanks in advance,
 
 Bruno.
Jun 23 2004