RAII trouble
    Spacen Jasset via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Nov 20 15:48:11 PST 2015
    
    
  
On Friday, 20 November 2015 at 23:35:50 UTC, Spacen Jasset wrote:
> On Friday, 20 November 2015 at 23:21:03 UTC, anonymous wrote:
>
> [...]
>> FT_Init_FreeType must be read at compile time, because 
>> freeType is a module level variable, and initializers for 
>> module variables must be static values. The initializer is run 
>> through CTFE (Compile Time Function Evaluation).
>> Put the initialization/assignment in a function and it should 
>> work. That function can be a static constructor or the main 
>> function:
>> ----
> [...]
>
>
> Yes, I see. I made a mistake. I need to initialize it 
> elsewhere. It was quite confusing.
>
> Thanks.
I Just noticed this trick you posted, that's interesting. Of 
course I couldn't get it working without the void to discard the 
initialization;
FreeType freeType = void; /* 'void' prevents default 
initialization */
static this() {freeType = FreeType.initialise();} /* should work 
*/
    
    
More information about the Digitalmars-d-learn
mailing list