On 07/19/2011 04:48 PM, Andrej Mitrovic wrote:
See if this works for you:

import core.runtime;

void myMainFunc()
{
}

extern (C)
int initializeDee()
{
     int result;
     void exceptionHandler(Throwable e) { throw e; }

     try
     {
         Runtime.initialize(&exceptionHandler);
         result = myMainFunc();
         Runtime.terminate(&exceptionHandler);
     }
     catch (Throwable o)
     {
         result = 0;
     }
     return result;
}

This is similar to how it's done for Windows GUI applications, where
we have to manually run the initialize function in druntime (unless
it's hidden by some GUI framework).

Thank you. It looks good, and I *will* be trying it. But my main point was that it needs to be in the documentation. (And notice that you still didn't say what libraries need to be linked, or that none do.)

I understand that most of the documentation is not specific to operating systems. And that's good. But where you *need* information about the operating system, the information needs to be there, just like the compiler options which differ between Linux and MSWind are documented differently.

And yes, what you displayed (i.e., the code) should be identical between OSes. But that's only the majority of the information needed. I think I could figure it out by checking what worked the last time I did it, even though that was with D1, but it really should be in the documentation. So, for that matter, should the code. If I knew where to post the request, I'd post it there, but as it is I'm just hoping that an appropriate person will read this and act on it.


Reply via email to