Last update January 17, 2007

Dcalled From C /
Discussion



Discussion

from the news pages about how to do organise the calls from C to D.


From NG:digitalmars.D/7361

Define a function called _init():

void _init(void)
{
   /* your code */
}

It will be called when the .so is loaded, just like DllMain. There's a _fini() function for unload time. "man dlopen" for details. It works even if you are not doing dynamic loading with dlopen()!


From NG:digitalmars.D/7362

According to the compiler page, DMD can't handle shared libraries. Are you using GDC?


Conclusion

To run D as a dynamic library under Linux it is necessary to use GDC.

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: January 17, 2007 19:12 (diff))