Given:

===============
extern(C):
char*[] hldr;
enum I = (1<<0);
struct S { char* ft; char** fm; int f; }

void main(){}
===============

How do I initialize an instance of S at global scope?

// Not sure how to do this... so try to keep as close to original as possible
// Nope, does not work
S[] s = [
    {
        cast(char*)"c",
        &hldr[0],
        I
    },
]

// Error: static variable C_HL_extensions cannot be read at compile time
S[] s = [ S(cast(char*)"c", &hldr[0], I) ];

// Error Deprecation: static constructor can only be of D linkage
S[] s;
static this() {
    s = [ S(cast(char*)"c", &hldr[0], I) ];
}

Thanks,
Andrew

Reply via email to