www.digitalmars.com         C & C++   DMDScript  

D - Dernel: _moduleCtor not working correct?

reply "=?iso-8859-1?Q?Robert_M._M=FCnch?=" <robert.muench robertmuench.de> writes:
Hi, I'm using static ctors with classes, so that some stuff is constructed  
before anything else uses it. Because I don't have the normal startup code  
in my D kernel, I'm calling _moduleCtor myself. But it seems that nothing  
happens.

Is the static ctor functionality not yet implemented? Am I missing  
something? Can I mix normal ctors and static ones, that's what I do.

-- 
Robert M. Münch
Management & IT Freelancer
http://www.robertmuench.de
Feb 24 2004
parent reply Marko Nikolic <markoni69 verat.net> writes:
Robert M. Münch wrote:

 Hi, I'm using static ctors with classes, so that some stuff is 
 constructed  before anything else uses it. Because I don't have the 
 normal startup code  in my D kernel, I'm calling _moduleCtor myself. But 
 it seems that nothing  happens.
 
 Is the static ctor functionality not yet implemented? Am I missing  
 something? Can I mix normal ctors and static ones, that's what I do.
Yes you can (mix normal and static ones) and it works for me. Did you called _minit() before _moduleCtor? I have problems when making library out of such modules (with static constructor/destructor) when static constructor/destructor are not called. My workaround is to use such modules directly on command line of dmd not in library :( Regards, Marko
Feb 24 2004
parent reply "=?iso-8859-1?Q?Robert_M._M=FCnch?=" <robert.muench robertmuench.de> writes:
On Tue, 24 Feb 2004 14:21:12 +0100, Marko Nikolic <markoni69 verat.net>  
wrote:

     Yes you can (mix normal and static ones) and it works for me. Did  
 you called _minit() before _moduleCtor?
Hi, no. What's this function for? I have to look it up.
     I have problems when making library out of such modules (with static  
 constructor/destructor) when static constructor/destructor are not  
 called. My workaround is to use such modules directly on command line of  
 dmd not in library :(
?? Not sure if I understood you correctly: You mean that you link such files as object files via the command line instead of using a lib file? -- Robert M. Münch Management & IT Freelancer http://www.robertmuench.de
Feb 24 2004
parent reply Marko Nikolic <markoni69 verat.net> writes:
Robert M. Münch wrote:
 On Tue, 24 Feb 2004 14:21:12 +0100, Marko Nikolic <markoni69 verat.net>  
 wrote:
 
     Yes you can (mix normal and static ones) and it works for me. Did  
 you called _minit() before _moduleCtor?
Hi, no. What's this function for? I have to look it up.
Have a look at winsamp.d at the samples directory.
     I have problems when making library out of such modules (with 
 static  constructor/destructor) when static constructor/destructor are 
 not  called. My workaround is to use such modules directly on command 
 line of  dmd not in library :(
?? Not sure if I understood you correctly: You mean that you link such files as object files via the command line instead of using a lib file?
No, I mean I have to include them on dmd command line as .d or .obj files. If I compile them and make library out of them then static constructors/destructors are not called. Anyway, if you did not call _minit() that could be the cause of the problem. Regards, Marko
Feb 24 2004
parent "=?iso-8859-1?Q?Robert_M._M=FCnch?=" <robert.muench robertmuench.de> writes:
On Tue, 24 Feb 2004 21:54:02 +0100, Marko Nikolic <markoni69 verat.net>  
wrote:

 Yes you can (mix normal and static ones) and it works for me. Did  you  
 called _minit() before _moduleCtor?
   Hi, no. What's this function for? I have to look it up.
     Have a look at winsamp.d at the samples directory.
This seems to be very windows specific to me. I'm using the Linux DMD version for Dernel. Looks like this doesn't solve my problem. Robert
Feb 25 2004