creating DLL using Tango fails.

Bjoern nanali at nospam-wanadoo.fr
Thu Jan 17 11:06:43 PST 2008


Hi,
Subject: Creating a DLL using Tango.
Beside / Dear Tango folks, please add some DLL info to the Tango WIKI;

My DLLMain as follows :

module dll.test;
import tango.sys.win32.UserGdi;

extern (C) bool  rt_init( void delegate( Exception ) dg = null );
extern (C) bool  rt_term( void delegate( Exception ) dg = null );
HINSTANCE g_hInst;

extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
     switch (ulReason)
     {
	case DLL_PROCESS_ATTACH:
         	rt_init();
		break;
	case DLL_PROCESS_DETACH:
		rt_term();
	    	break;

	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	    // Multiple threads not supported yet
	    return false;
     }
     g_hInst=hInstance;
     return true;
}

// a DLL func ..
alias extern(Windows) void function(char[] token, bool eof = false) 
LexerCallBack;
extern(Windows) export bool Lexer(LexerCallBack cb, char* code)
{
bla ...
}

Is /Tangofied/   DLLMain  correct ?

My DEF
LIBRARY "testdll.dll"
EXETYPE NT
SUBSYSTEM WINDOWS
CODE SHARED EXECUTE
DATA WRITE

DLL creating fails ....
C:\dmd\projects>dmd -oftestdll.dll dll.d testdll.def
C:\dmd\bin\link.exe 
dll,testdll.dll,,user32+kernel32,testdll.def/noi+tango-user-
dmd.lib;
OPTLINK ....
OPTLINK : Warning 183: Extension not .RES : tango-user-dmd.lib
C:\dmd\bin\..\lib\tango-user-dmd.lib
  Error 30: Unexpected End of File

I use the DMD snapshots updated for 1.025. Tango only.

Any ideas ?

Bjoern



More information about the Digitalmars-d mailing list