I should also add that I allocated my structure with:
(init)
s.filedesc = cast(File*)GC.calloc(1,File.sizeof);
(open)
(*(s.filedesc)).open(*(cast(string*)arg),"w+b");
OMG! That solution works! Except that I was making a silly
mistake and thought that GC.alloc() prototype is similar to C's
calloc (since it has two parameters).
I fact, after writing:
(init)
s.filedesc = cast(File*)GC.calloc(File.sizeof*1);
(open)
(*(s.filedesc)).open(*(cast(string*)arg),"w+b");
now, my file remains open and I can write inside!
(The data inside is not really what it should be, but that, at
least, is a debugging problem, not a segfault one).
Thank you once again!