Let suppose I'm writing a library for Win32 applications, called "mylibrary". A program, called "UserProgram", that uses this library would be like this:

UserProgram.d:
import mylibrary;
import std.c.windows.windows;
int WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR cmdLine,int cmdShow)
{
    //initialization of mylibrary
    //usercode
    //de-initialization of mylibrary
}

What I was trying to do with prova0 and prova00 was something like this:

mylibrary.d:
public import std.c.windows.windows;
extern(C) void UserMain();
int WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR cmdLine,int cmdShow)
{
    //initialization of mylibrary
    UserMain();
    //de-initialization of mylibrary
}
UserProgram.d:
import mylibrary;
extern(C) void UserMain()
{
    //usercode
}

This second way would be much cleaner for the user of the library.
P.S.: Sorry for my english: I know I'm not very good in it.

Reply via email to