Thread overview
Dernel: _moduleCtor not working correct?
Feb 24, 2004
Robert M. Münch
Feb 24, 2004
Marko Nikolic
Feb 24, 2004
Robert M. Münch
Feb 24, 2004
Marko Nikolic
Feb 25, 2004
Robert M. Münch
February 24, 2004
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
February 24, 2004
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
February 24, 2004
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
February 24, 2004
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
February 25, 2004
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