www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How to create a DLL

reply Frank Benoit <keinfarbton googlemail.com> writes:
I try to build a DLL with dmd on windows with tango.

with empty functions that worked. When i put only a switch statement
into a method, the linker complains about a missing "__Dmain". Why is that?
Jun 14 2007
next sibling parent reply torhu <fake address.dude> writes:
Frank Benoit wrote:
 I try to build a DLL with dmd on windows with tango.
 
 with empty functions that worked. When i put only a switch statement
 into a method, the linker complains about a missing "__Dmain". Why is that?

Did you include a DllMain? http://www.digitalmars.com/d/dll.html Also check out the mydll example the comes with dmd.
Jun 14 2007
parent Sean Kelly <sean f4.ca> writes:
torhu wrote:
 Frank Benoit wrote:
 I try to build a DLL with dmd on windows with tango.

 with empty functions that worked. When i put only a switch statement
 into a method, the linker complains about a missing "__Dmain". Why is 
 that?

Did you include a DllMain? http://www.digitalmars.com/d/dll.html Also check out the mydll example the comes with dmd.

Please note that the process of actually initializing the runtime for a Tango DLL is somewhat different than Phobos. You basically just call rt_init() to initialize and rt_term() to terminate. I'll see about documenting this somewhere. Sean
Jun 14 2007
prev sibling parent reply Charlie <charlie.fats gmail.com> writes:
Frank Benoit wrote:
 I try to build a DLL with dmd on windows with tango.
 
 with empty functions that worked. When i put only a switch statement
 into a method, the linker complains about a missing "__Dmain". Why is that?

I don't think DLL's are created with the linker, they are created with lib.exe -> http://www.digitalmars.com/ctg/lib.html
Jun 14 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Charlie wrote:
 Frank Benoit wrote:
 I try to build a DLL with dmd on windows with tango.

 with empty functions that worked. When i put only a switch statement
 into a method, the linker complains about a missing "__Dmain". Why is 
 that?

I don't think DLL's are created with the linker, they are created with lib.exe -> http://www.digitalmars.com/ctg/lib.html

No, DLLs (aka Dynamic Link Libraries) are created by the linker. Libraries (aka Static Link Libraries) are created by lib.
Jun 14 2007
parent Charlie <charlie.fats gmail.com> writes:
Walter Bright wrote:
 Charlie wrote:
 Frank Benoit wrote:
 I try to build a DLL with dmd on windows with tango.

 with empty functions that worked. When i put only a switch statement
 into a method, the linker complains about a missing "__Dmain". Why is 
 that?

I don't think DLL's are created with the linker, they are created with lib.exe -> http://www.digitalmars.com/ctg/lib.html

No, DLLs (aka Dynamic Link Libraries) are created by the linker. Libraries (aka Static Link Libraries) are created by lib.

Ack, ignore me !
Jun 16 2007