FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Making DLL requires -gui flag?

 
Post new topic   Reply to topic     Forum Index -> Build
View previous topic :: View next topic  
Author Message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Sun Feb 18, 2007 6:42 pm    Post subject: Making DLL requires -gui flag? Reply with quote

Just trying to run the basic DLL example from here:
http://www.digitalmars.com/d/dll.html

When I run Bud on it (with a simple bud mydll.d), I get a ton of linker errors. It seems to build a valid dll, but the linker errors are annoying.

I noticed that adding the -gui flag got rid of the linker errors. Is this the right thing to do? Perhaps -gui should be added automatically if bud finds either WinMain or DLLMain?

Seems odd, anyway, because clearly this DLL contians no GUI. I guess -gui really just means "link with the everything and the kitchen sink".


[edit]
Further info here. Actually it's weirder than I thought. bud -gui foo.d builds a dll, but for some reason it crashes at the first call to it.

Following the directions on the above page using dmd directly works fine. The sizes of the DLLs created both ways have the same size.

So is bud doing anything besides just the plain vanilla specified on that page?
Namely linking like this:
Code:

dmd -ofddll.dll ddll.d ddll_vc.def


Using a def file like this:
Code:

LIBRARY ddll.dll
EXETYPE      NT


Because that seems to work fine. Whatever bud is doing does not.


Any ideas?
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Sun Feb 18, 2007 10:34 pm    Post subject: Re: Making DLL requires -gui flag? Reply with quote

baxissimo wrote:

Whatever bud is doing does not.
Any ideas?

For some stupid reason, I forgot to link in kernel32 and user32 libraries when doing a DLL link. You can add these to your command line until I fix the code.

Code:

bud somedll.d user32.lib kernel32.lib

_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Sun Feb 18, 2007 10:43 pm    Post subject: Reply with quote

Boffo! That works!

--bb
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Build All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group