www.digitalmars.com         C & C++   DMDScript  

D - Error 42 with a struct?

reply "Keir" <keir verizon.net> writes:
Any thoughts why I'd get a ...

Error 42: Symbol Undefined __init_win_DEVMODE

...when linking when DEVMODE is nothing more then a struct?

...and where does the "__init_win_" come from?
Feb 18 2003
parent reply Burton Radons <loth users.sourceforge.net> writes:
Keir wrote:
 Any thoughts why I'd get a ...
 
 Error 42: Symbol Undefined __init_win_DEVMODE
 
 ...when linking when DEVMODE is nothing more then a struct?

Structs have initial values too, and those initial values are stored in DMD as a hidden symbol. You need to link whatever file is "win.d" into the executable.
 ...and where does the "__init_win_" come from?

If you don't have a file named win.d, then it'll be from a file with the command "module win;" at the top of it.
Feb 18 2003
parent "Keir" <keir verizon.xyz.net> writes:
okay... but if I change something in windows.d within the src directory  ...

like removing the (int) from line 1523 and changing the enum to enum:uint

the compiler/linker seems to pick up on it...

I copied the DEVMODE struct out of the win.d and put it into the main .d
program and the error went away also...

Keir Blatter wrote:
 oah.  (weird)... so why dont I have to link windows.d and strings.d in as
 well?
 are they precompiled?  Floating around somewhere and 'known' about?

Those are compiled in the phobos.lib library, which is always linked in. "Burton Radons" <loth users.sourceforge.net> wrote in message news:b2uuom$1io1$1 digitaldaemon.com... Keir wrote:
 Any thoughts why I'd get a ...

 Error 42: Symbol Undefined __init_win_DEVMODE

 ...when linking when DEVMODE is nothing more then a struct?

Structs have initial values too, and those initial values are stored in DMD as a hidden symbol. You need to link whatever file is "win.d" into the executable.
 ...and where does the "__init_win_" come from?

If you don't have a file named win.d, then it'll be from a file with the command "module win;" at the top of it.
Feb 19 2003