www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - how to init D runtime from C's main?

reply newbie d.com writes:
Suppose the main() *HAS TO BE* in C, what's the correct way to init D's runtime
so C call D func later?

I checked: http://www.digitalmars.com/d/windows.html

It seems we can do something like this:

main.c:

int main()
{
gc_init();			// initialize GC
_minit();			// initialize module list
_moduleCtor();		// run module constructors
_moduleUnitTests();		// run module unit tests

..
callCFunc();
callDFunc();

}

Can anyone confirm this is the correct way to init D runtime in general (on both
Linux & Win32)?
Jan 06 2005
parent "Walter" <newshound digitalmars.com> writes:
Check out the source code \dmd\src\phobos\internal\dmain2.d, that should
provide all the info needed.

<newbie d.com> wrote in message news:crlbv0$13gr$1 digitaldaemon.com...
 Suppose the main() *HAS TO BE* in C, what's the correct way to init D's
runtime
 so C call D func later?
Jan 07 2005