digitalmars.D - creating DLL using Tango fails.
- Bjoern (54/54) Jan 17 2008 Hi,
- Sean Kelly (9/73) Jan 17 2008 One of the items in DFLAGS in sc.ini is this:
- Bjoern (5/18) Jan 17 2008 Okay. Could using an response file solve the problem ?
- Jascha Wetzel (16/40) Jan 17 2008 it works for me with:
- Bjoern (7/7) Jan 17 2008 [Version]
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
Jan 17 2008
Bjoern wrote:
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 ?
One of the items in DFLAGS in sc.ini is this:
-L+tango-user-dmd.lib
It's an instruction to the linker to pull in tango-user-dmd.lib. For
whatever reason however, the linker doesn't seem to like this when
you're building a DLL. I don't know why however, nor do I know of a
simple fix. If someone could suggest one I'd be happy to make any
necessary changes.
Sean
Jan 17 2008
Sean Kelly schrieb:One of the items in DFLAGS in sc.ini is this: -L+tango-user-dmd.lib It's an instruction to the linker to pull in tango-user-dmd.lib. For whatever reason however, the linker doesn't seem to like this when you're building a DLL. I don't know why however, nor do I know of a simple fix. If someone could suggest one I'd be happy to make any necessary changes. SeanOkay. Could using an response file solve the problem ? like : LINK linklist I don't know and I am tired. Thanks, Bjoern
Jan 17 2008
Sean Kelly wrote:Bjoern wrote:it works for me with: link all+my+object+files+separated+with+pluses,my.dll,,user32+kernel32+tango-base-dmd+tango-user-dmd,my ll.def/noi/CODEVIEW i think the lib file may not be added at the end after the noi option, but has to added in the libraries-section (sections are separated by commas), just for completeness, my .def file: LIBRARY seatd_scite DESCRIPTION 'Semantics Aware Tools for D' EXETYPE NT SUBSYSTEM WINDOWS CODE SHARED EXECUTE DATA WRITE EXPORTS get_SciTE_extensionDLL 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 ?One of the items in DFLAGS in sc.ini is this: -L+tango-user-dmd.lib It's an instruction to the linker to pull in tango-user-dmd.lib. For whatever reason however, the linker doesn't seem to like this when you're building a DLL. I don't know why however, nor do I know of a simple fix. If someone could suggest one I'd be happy to make any necessary changes.
Jan 17 2008
[Version] version=7.51 Build 020 [Environment] LIB="% P%\..\lib" DFLAGS="-I% P%\..\import" -version=Tango -defaultlib=tango-base-dmd.lib - debuglib=tango-base-dmd.lib tango-user-dmd.lib LINKCMD=% P%\link.exe
Jan 17 2008









Bjoern <nanali nospam-wanadoo.fr> 