Jump to page: 1 2
Thread overview
Sample Problem
Mar 05, 2003
Gary
Mar 05, 2003
Patrick Down
Mar 05, 2003
Gary
Mar 05, 2003
Patrick Down
Mar 05, 2003
Gary
Mar 05, 2003
Mike Wynn
Mar 05, 2003
Dario
Mar 05, 2003
Ilya Minkov
Mar 06, 2003
Gary
Mar 07, 2003
Walter
Mar 07, 2003
Mike Wynn
Mar 07, 2003
Ilya Minkov
Mar 08, 2003
Walter
Mar 06, 2003
Walter
Mar 06, 2003
Gary
How to make a small & optimized phobos.lib?
Mar 06, 2003
Gerd Schmidt
Mar 07, 2003
Walter
March 05, 2003
Sorry if you've all heard this before, but... I'm having a problem compiling/linking the winsamp.d sample program... as follows:

D:\dmd\samples\d>dmd winsamp.d
D:\DMD\BIN\..\..\dm\bin\link.exe winsamp,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

winsamp.obj(winsamp)
 Error 42: Symbol Undefined _CreateFontA@56
winsamp.obj(winsamp)
 Error 42: Symbol Undefined _SelectObject@8
winsamp.obj(winsamp)
 Error 42: Symbol Undefined _SetTextAlign@8
winsamp.obj(winsamp)
 Error 42: Symbol Undefined _TextOutA@20
--- errorlevel 4

D:\dmd\samples\d>


Please help... Gary.


March 05, 2003
Try

dmd winsamp32.d gdi32.lib


"Gary" <gedumer@bcpl.net> wrote in news:b43lh7$109j$1@digitaldaemon.com:

> Sorry if you've all heard this before, but... I'm having a problem compiling/linking the winsamp.d sample program... as follows:
> 
> D:\dmd\samples\d>dmd winsamp.d
> D:\DMD\BIN\..\..\dm\bin\link.exe winsamp,,,user32+kernel32/noi;
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> 
> winsamp.obj(winsamp)
>  Error 42: Symbol Undefined _CreateFontA@56
> winsamp.obj(winsamp)
>  Error 42: Symbol Undefined _SelectObject@8
> winsamp.obj(winsamp)
>  Error 42: Symbol Undefined _SetTextAlign@8
> winsamp.obj(winsamp)
>  Error 42: Symbol Undefined _TextOutA@20
> --- errorlevel 4
> 
> D:\dmd\samples\d>
> 
> 
> Please help... Gary.
> 
> 

March 05, 2003
Isn't there a way to compile it using gdi32.dll instead of statically linking the whole gdi library? The resulting 91K exe is a bit much.

"Patrick Down" <pat@codemoon.com> wrote in message news:Xns9334D2F054EB9patcodemooncom@63.105.9.61...
> Try
>
> dmd winsamp32.d gdi32.lib
>
>
> "Gary" <gedumer@bcpl.net> wrote in news:b43lh7$109j$1@digitaldaemon.com:
>
> > Sorry if you've all heard this before, but... I'm having a problem compiling/linking the winsamp.d sample program... as follows:
> >
> > D:\dmd\samples\d>dmd winsamp.d
> > D:\DMD\BIN\..\..\dm\bin\link.exe winsamp,,,user32+kernel32/noi;
> > OPTLINK (R) for Win32  Release 7.50B1
> > Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> >
> > winsamp.obj(winsamp)
> >  Error 42: Symbol Undefined _CreateFontA@56
> > winsamp.obj(winsamp)
> >  Error 42: Symbol Undefined _SelectObject@8
> > winsamp.obj(winsamp)
> >  Error 42: Symbol Undefined _SetTextAlign@8
> > winsamp.obj(winsamp)
> >  Error 42: Symbol Undefined _TextOutA@20
> > --- errorlevel 4
> >
> > D:\dmd\samples\d>
> >
> >
> > Please help... Gary.
> >
> >
>


March 05, 2003
Actually gdi32.lib has little actual code in it.  It just provides symbolic linkage to the DLL.  Also you probably need to look a the space a simple hello world takes up, some people remark that the D runtime is a little large.  It's all a trade off.  Most runtimes don't have a GC in them.


In article <b453fa$1qam$1@digitaldaemon.com>, Gary says...
>
>Isn't there a way to compile it using gdi32.dll instead of statically linking the whole gdi library? The resulting 91K exe is a bit much.
>
>"Patrick Down" <pat@codemoon.com> wrote in message news:Xns9334D2F054EB9patcodemooncom@63.105.9.61...
>> Try
>>
>> dmd winsamp32.d gdi32.lib
>>
>>
>> "Gary" <gedumer@bcpl.net> wrote in news:b43lh7$109j$1@digitaldaemon.com:
>>
>> > Sorry if you've all heard this before, but... I'm having a problem compiling/linking the winsamp.d sample program... as follows:
>> >
>> > D:\dmd\samples\d>dmd winsamp.d
>> > D:\DMD\BIN\..\..\dm\bin\link.exe winsamp,,,user32+kernel32/noi;
>> > OPTLINK (R) for Win32  Release 7.50B1
>> > Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>> >
>> > winsamp.obj(winsamp)
>> >  Error 42: Symbol Undefined _CreateFontA@56
>> > winsamp.obj(winsamp)
>> >  Error 42: Symbol Undefined _SelectObject@8
>> > winsamp.obj(winsamp)
>> >  Error 42: Symbol Undefined _SetTextAlign@8
>> > winsamp.obj(winsamp)
>> >  Error 42: Symbol Undefined _TextOutA@20
>> > --- errorlevel 4
>> >
>> > D:\dmd\samples\d>
>> >
>> >
>> > Please help... Gary.
>> >
>> >
>>
>
>


March 05, 2003
Wow... you're right... I didn't realize how large the hello world sample really was.

Having said that however... getting back to my original question, is there any way to compile it using gdi32.dll instead of statically linking the whole gdi library?

Gary

> >linking the whole gdi library
"Patrick Down" <Patrick_member@pathlink.com> wrote in message news:b457to$1t6v$1@digitaldaemon.com...
>
> Actually gdi32.lib has little actual code in it.  It just provides symbolic linkage to the DLL.  Also you probably need to look a the space a simple hello world takes up, some people remark that the D runtime is a little large.  It's all a trade off.  Most runtimes don't have a GC in them.
>
>
> In article <b453fa$1qam$1@digitaldaemon.com>, Gary says...
> >
> >Isn't there a way to compile it using gdi32.dll instead of statically linking the whole gdi library? The resulting 91K exe is a bit much.
> >
> >"Patrick Down" <pat@codemoon.com> wrote in message news:Xns9334D2F054EB9patcodemooncom@63.105.9.61...
> >> Try
> >>
> >> dmd winsamp32.d gdi32.lib
> >>
> >>
> >> "Gary" <gedumer@bcpl.net> wrote in
news:b43lh7$109j$1@digitaldaemon.com:
> >>
> >> > Sorry if you've all heard this before, but... I'm having a problem compiling/linking the winsamp.d sample program... as follows:
> >> >
> >> > D:\dmd\samples\d>dmd winsamp.d
> >> > D:\DMD\BIN\..\..\dm\bin\link.exe winsamp,,,user32+kernel32/noi;
> >> > OPTLINK (R) for Win32  Release 7.50B1
> >> > Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> >> >
> >> > winsamp.obj(winsamp)
> >> >  Error 42: Symbol Undefined _CreateFontA@56
> >> > winsamp.obj(winsamp)
> >> >  Error 42: Symbol Undefined _SelectObject@8
> >> > winsamp.obj(winsamp)
> >> >  Error 42: Symbol Undefined _SetTextAlign@8
> >> > winsamp.obj(winsamp)
> >> >  Error 42: Symbol Undefined _TextOutA@20
> >> > --- errorlevel 4
> >> >
> >> > D:\dmd\samples\d>
> >> >
> >> >
> >> > Please help... Gary.
> >> >
> >> >
> >>
> >
> >
>
>


March 05, 2003
"Gary" <gedumer@bcpl.net> wrote in message news:b45n7m$27g3$1@digitaldaemon.com...
> Wow... you're right... I didn't realize how large the hello world sample really was.
>
> Having said that however... getting back to my original question, is there any way to compile it using gdi32.dll instead of statically linking the whole gdi library?

read the reply, gdi32.lib is the lib to link your app to gdi32.dll
gdi.dll is 218K on my machine (win2K)  check your gdi32.dll if its more than
90K the obviously your app does not have it statically linked.

the size of your app is due to the size of the phobos+gc libs which are statically linked.

>
> Gary
>
> > >linking the whole gdi library
> "Patrick Down" <Patrick_member@pathlink.com> wrote in message news:b457to$1t6v$1@digitaldaemon.com...
> >
> > Actually gdi32.lib has little actual code in it.  It just provides symbolic linkage to the DLL.  Also you probably need to look a the space a simple hello world takes up, some people remark that the D runtime is a little large.  It's all a trade off.  Most runtimes don't have a GC in them.
> >
> >
> > In article <b453fa$1qam$1@digitaldaemon.com>, Gary says...
> > >
> > >Isn't there a way to compile it using gdi32.dll instead of statically linking the whole gdi library? The resulting 91K exe is a bit much.
> > >
> > >"Patrick Down" <pat@codemoon.com> wrote in message news:Xns9334D2F054EB9patcodemooncom@63.105.9.61...
> > >> Try
> > >>
> > >> dmd winsamp32.d gdi32.lib
> > >>
> > >>
> > >> "Gary" <gedumer@bcpl.net> wrote in
> news:b43lh7$109j$1@digitaldaemon.com:
> > >>
> > >> > Sorry if you've all heard this before, but... I'm having a problem compiling/linking the winsamp.d sample program... as follows:
> > >> >
> > >> > D:\dmd\samples\d>dmd winsamp.d
> > >> > D:\DMD\BIN\..\..\dm\bin\link.exe winsamp,,,user32+kernel32/noi;
> > >> > OPTLINK (R) for Win32  Release 7.50B1
> > >> > Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> > >> >
> > >> > winsamp.obj(winsamp)
> > >> >  Error 42: Symbol Undefined _CreateFontA@56
> > >> > winsamp.obj(winsamp)
> > >> >  Error 42: Symbol Undefined _SelectObject@8
> > >> > winsamp.obj(winsamp)
> > >> >  Error 42: Symbol Undefined _SetTextAlign@8
> > >> > winsamp.obj(winsamp)
> > >> >  Error 42: Symbol Undefined _TextOutA@20
> > >> > --- errorlevel 4
> > >> >
> > >> > D:\dmd\samples\d>
> > >> >
> > >> >
> > >> > Please help... Gary.
> > >> >
> > >> >
> > >>
> > >
> > >
> >
> >
>
>


March 05, 2003
Again: gdi32 *code* is not linked into an application. gdi32.lib is a "stub library", which contains no real code, but simply loads *the functions you use from the DLL* into your application at startup. It doesn't actually increase the executable size.

Your example is not really large. Consider: if you compile hello-world with DMC, you get about 45K executable. It contains a few parts of C library. Now, phobos partially wraps C library, and also adds a couple of dozen kilos for a GC and somesuch. Now, there you have it. it simply *can't* be much smaller than that.

I assume DMC links C standard library into the executable, else the minimal program size would go down to 8 kilobytes. LCC-Win32 and some versions of MingW use M1cro$oft's msvcrt.dll, which is almost 300K large and is distributed with W1nd0w$, and is a C standard library implementation.

Unless the library is moved into a DLL, the size won't go down.

BTW, is there an *easy* way to make shared libraries of object code, which would probably work with only one compiler, but would requiere no changes in source? Delphi allows to use its DLL derivate, simply create a "package" and specify "use run-time packages" instead of "link with packages" when compiling applications.

-i.

Gary wrote:
> Wow... you're right... I didn't realize how large the hello world sample
> really was.
> 
> Having said that however... getting back to my original question, is there
> any way to compile it using gdi32.dll instead of statically linking the
> whole gdi library?
> 
> Gary
> 

March 05, 2003
> > Wow... you're right... I didn't realize how large the hello world sample really was.
> >
> > Having said that however... getting back to my original question, is
there
> > any way to compile it using gdi32.dll instead of statically linking the whole gdi library?

> read the reply, gdi32.lib is the lib to link your app to gdi32.dll gdi.dll is 218K on my machine (win2K)  check your gdi32.dll if its more
than
> 90K the obviously your app does not have it statically linked.
>
> the size of your app is due to the size of the phobos+gc libs which are statically linked.

Why is phobos.lib really linked in the hello world sample program if none of
its
function is used? I think that the linker should exclude functions which are
not used.
Even the GC should be excluded if no objects are allocated.

Can we develop a more powerful linker without giving up the classic
compile/link model?
Anyway, I think that a cleverer linking system is worth the drop of that
model.


March 06, 2003
Thanks Ilya... your very kind, considerate, and thorough reply is most welcome. I now understand.

Thanks again... Gary.

"Ilya Minkov" <midiclub@8ung.at> wrote in message news:b45si3$2b9o$1@digitaldaemon.com...
> Again: gdi32 *code* is not linked into an application. gdi32.lib is a "stub library", which contains no real code, but simply loads *the functions you use from the DLL* into your application at startup. It doesn't actually increase the executable size.
>
> Your example is not really large. Consider: if you compile hello-world with DMC, you get about 45K executable. It contains a few parts of C library. Now, phobos partially wraps C library, and also adds a couple of dozen kilos for a GC and somesuch. Now, there you have it. it simply *can't* be much smaller than that.
>
> I assume DMC links C standard library into the executable, else the minimal program size would go down to 8 kilobytes. LCC-Win32 and some versions of MingW use M1cro$oft's msvcrt.dll, which is almost 300K large and is distributed with W1nd0w$, and is a C standard library
implementation.
>
> Unless the library is moved into a DLL, the size won't go down.
>
> BTW, is there an *easy* way to make shared libraries of object code, which would probably work with only one compiler, but would requiere no changes in source? Delphi allows to use its DLL derivate, simply create a "package" and specify "use run-time packages" instead of "link with packages" when compiling applications.
>
> -i.
>
> Gary wrote:
> > Wow... you're right... I didn't realize how large the hello world sample really was.
> >
> > Having said that however... getting back to my original question, is
there
> > any way to compile it using gdi32.dll instead of statically linking the whole gdi library?
> >
> > Gary
> >
>


March 06, 2003
"Patrick Down" <Patrick_member@pathlink.com> wrote in message news:b457to$1t6v$1@digitaldaemon.com...
>
> Actually gdi32.lib has little actual code in it.  It just provides symbolic linkage to the DLL.  Also you probably need to look a the space a simple hello world takes up, some people remark that the D runtime is a little large.  It's all a trade off.  Most runtimes don't have a GC in them.

The gc adds some code (maybe 40k). A big chunk comes, however, from all the unit tests in phobos.lib. Those should be removed from a release build, it is built now with all the debug checks and unit tests on.


« First   ‹ Prev
1 2