www.digitalmars.com         C & C++   DMDScript  

D - What's this __init_* stuff about?

reply "Robert M. Münch" <robert.muench robertmuench.de> writes:
Hi, while playing with TinyPTC (yes I don't give up on it!) I had the
following problem:

d:\develop\dmd\samples\tinypc]dmd voxel.d tinyptc.obj
link voxel+tinyptc,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

tinyptc.obj(tinyptc)
 Error 42: Symbol Undefined __init_win32_RECT
tinyptc.obj(tinyptc)
 Error 42: Symbol Undefined __init_win32_MSG
--- errorlevel 2


Strange... I had a look at the win32.d sources and RECT and MSG are structs.
So this __init* stuff should be added by the compiler (to initialize the
data members?) and it seems as this functions are missing. So what's the
problem here? Is it a compiler but? Am I missing some link files?

--
Robert M. Münch
IT & Management Freelancer
Mobile: +49 (0)177 2452 802
Fax   : +49 (0)721 8408 9112
Web   : http://www.robertmuench.de
Jul 06 2002
parent reply Burton Radons <loth users.sourceforge.net> writes:
Robert M. Münch wrote:

 Hi, while playing with TinyPTC (yes I don't give up on it!) I had the
 following problem:
 
 d:\develop\dmd\samples\tinypc]dmd voxel.d tinyptc.obj
 link voxel+tinyptc,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 tinyptc.obj(tinyptc)
  Error 42: Symbol Undefined __init_win32_RECT
 tinyptc.obj(tinyptc)
  Error 42: Symbol Undefined __init_win32_MSG
 --- errorlevel 2
 
 
 Strange... I had a look at the win32.d sources and RECT and MSG are structs.
 So this __init* stuff should be added by the compiler (to initialize the
 data members?) and it seems as this functions are missing. So what's the
 problem here? Is it a compiler but? Am I missing some link files?

Pavel earlier told you to rename windows.d to win32.d, and you've done that. But win32.obj is in no library, so you have to include it in the compile command, such as with this exact line, nothing different, with all these files in the current directory: dmd voxel.d tinyptc.d win32.d win32util.d The compiler will search for module dependencies when compiling the source, but needs its hand held during link time. So it can't tell that it needs win32.d for linking - the only thing the linker knows is that it can't find these symbols when it looks for them.
Jul 06 2002
parent reply "Robert M. Münch" <robert.muench robertmuench.de> writes:
"Burton Radons" <loth users.sourceforge.net> schrieb im Newsbeitrag
news:3D26E0C5.4060209 users.sourceforge.net...

 Pavel earlier told you to rename windows.d to win32.d, and you've done
 that.  But win32.obj is in no library, so you have to include it in the
 compile command, such as with this exact line, nothing different, with
 all these files in the current directory:

      dmd voxel.d tinyptc.d win32.d win32util.d

 The compiler will search for module dependencies when compiling the
 source, but needs its hand held during link time.  So it can't tell that
 it needs win32.d for linking - the only thing the linker knows is that
 it can't find these symbols when it looks for them.

Hi, ok thanks. I just didn't understood it the first time :-||. Robert
Jul 06 2002
parent "Sean L. Palmer" <seanpalmer earthlink.net> writes:
This is the kind of thing I believe could be greatly improved with compiler
design.  Surely the compiler could embed enough info in the .OBJ files that
the linker could find everything it needs during link without having its
hand held.

Sean

"Robert M. Münch" <robert.muench robertmuench.de> wrote in message
news:ag714u$127s$1 digitaldaemon.com...
 "Burton Radons" <loth users.sourceforge.net> schrieb im Newsbeitrag
 news:3D26E0C5.4060209 users.sourceforge.net...

 Pavel earlier told you to rename windows.d to win32.d, and you've done
 that.  But win32.obj is in no library, so you have to include it in the
 compile command, such as with this exact line, nothing different, with
 all these files in the current directory:

      dmd voxel.d tinyptc.d win32.d win32util.d

 The compiler will search for module dependencies when compiling the
 source, but needs its hand held during link time.  So it can't tell that
 it needs win32.d for linking - the only thing the linker knows is that
 it can't find these symbols when it looks for them.

Hi, ok thanks. I just didn't understood it the first time :-||. Robert

Jul 07 2002