Using an uninitialized structure

Regan Heath regan at netmail.co.nz
Mon Sep 3 09:29:35 PDT 2007


B. Schulte wrote:
> Regan Heath Wrote:
> 
>> Where is the definition of the CHAR_INFO structure?  Have you defined it 
>> in your code? eg.
>>
>> import std.c.windows.windows;
>>
>> extern(C)
>> {
>> 	struct CHAR_INFO {
>> 	    union _Char {
>> 		WCHAR UnicodeChar;
>> 		CHAR   AsciiChar;
>> 	    }
>> 	    _Char Char;
>> 	    WORD Attributes;
>> 	}
>> 	alias CHAR_INFO* PCHAR_INFO;
>> }
>>
>> void main()
>> {
>> 	CHAR_INFO buffer[];
>> 	buffer.length = 100;
>> 	foreach( inout CHAR_INFO ci; buffer ) { ci.Char.AsciiChar = ' '; 
>> ci.Attributes=7; }
>> }
>>
>> Regan
> Well, the CHAR_INFO structure is stored in the win32.wincon file. There was something I took from dsource to use the winAPI methods. 
> 
> I didn't want to write in orginal files to fix a problem. I thought about fixing the problem somewhere else. (Don't modify the wincon.d)
> 
> However, it still doesn't work.
> Error 42: Symbol Undefined _D5win326wincon9CHAR_INFO6__initZ
> 
> 
> There must be some way to use uninitialized variables :(
> 

I've found win32.wincon here:
http://www.dsource.org/projects/bindings/browser/trunk/win32/wincon.d

Is that the one you used?

I think you had better post your entire source file and the command line 
you are using to compile.

Regan



More information about the Digitalmars-d mailing list