The proper case for D.

Robert Fraser fraserofthenight at gmail.com
Sun Jun 21 00:52:44 PDT 2009


Walter Bright wrote:
> Optlink does not discard unreference symbols, it just doesn't pull them 
> in from the library. If it did always pull in everything from the 
> library, then the minimum D executable size will be the size of Phobos.
> 
> Since that isn't happening, something else is happening with your code. 
> I bet that those unreferenced symbols *are* being referenced. You can 
> determine this by using the librarian to remove those 'unreferenced' 
> symbols from Phobos, and then link, and see if there are any unresolved 
> symbol error messages.

Hmmm... well, I built a 3rd-party library (Platinum UPnP + Neptune) into 
two static libraries (with VS). I then wrote a C wrapper function around 
one, just to test out the functionality I needed (a fraction of what was 
available). Originally, I wanted to statically link it with my D project 
so I ran objconv on the libs (COFF -> OMF). I created a test D app that 
was basically just:

extern(C) int cMain();
int main(char[][] args) { return cMain(); }

... And linked it to the OMF version of the library. Worked fine, but 
the result was ~12MB, which is about 200k larger than the two libraries. 
I'm now using VC++ to build it into a DLL that exposes the function. 
802kb for a debug DLL, 280k for a release.

The same thing is happening with my other library (ffmpeg -- libavcodec, 
libavformat, libavutil and swscale), which I built as static libraries 
with MinGW gcc and converted again with objconv. In this case, I'm too 
lazy to create a DLL to wrap only the functions I want, though I may end 
up doing just that once my project gets closer to usable.



More information about the Digitalmars-d mailing list