www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.loader and libs

reply Denis R <denis_r telkomsa.net> writes:
Hello, 

A small loader question. Well, related to loader.

Suppose I want to create these libs using D code, is that bad idea ? Are there
special things to take care of (and how), like
GC?  Data not shareable ?

Coudnt one define some special constructors/destructors for D library code like
one would do in C (using gcc)

void __attribute__ ((constructor)) my_init(void);
void __attribute__ ((destructor)) my_fini(void);
May 19 2005
parent Denis R <Denis_member pathlink.com> writes:
I guess 99% of  http://www.digitalmars.com/d/dll.html  applies here.

No returning ptrs gc allocated memory, etc.

Instread of Window' s  extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG
ulReason, LPVOID pvReserved),  I think I can do 

extern (C) void __attribute__ ((constructor)) my_init(void);  and
extern (C) void __attribute__ ((destructor)) my_fini(void);

and put gc_init(); _minit();  in constructor,  
while  gc_term();  in destructor. 

This could be just fine 


In article <20050520010321.42cc4051.denis_r telkomsa.net>, Denis R says...
Hello, 

A small loader question. Well, related to loader.

Suppose I want to create these libs using D code, is that bad idea ? Are there
special things to take care of (and how), like
GC?  Data not shareable ?

Coudnt one define some special constructors/destructors for D library code like
one would do in C (using gcc)

void __attribute__ ((constructor)) my_init(void);
void __attribute__ ((destructor)) my_fini(void);

May 20 2005