[SDL] Embed SDL.dll in the .exe

Charles McGarvey onefriedrice at brokenzipper.com
Fri Sep 28 16:41:06 PDT 2007


On Sep 28, 2007, at 9:22 AM, Sylvain Beucler wrote:

> On Fri, Sep 28, 2007 at 08:41:03AM -0600, Charles McGarvey wrote:
>> FYI: Drag 'n drop installation works on Mac OS X without complete
>> static linking because applications are really "bundles" or
>> directories made to look like files.  So you can dynamic link to
>> libraries you put inside the bundle which provides the benefits of
>> brain-dead installation and the benefits of dynamic linking
>> (including satisfying the LGPL license).
>
>
> I believe you still need an installer if you distribute the
> application via Internet.

You do not.  You just archive the .app bundle any way you want (dmg  
is popular).  To install, you just unarchive and move the .app bundle  
wherever you want (usually the Applications folder).

>
> If I understand correctly:
>
> - the app (something.app) is displayed as a single executable to the
>   user, from the file browser ("Finder")

Correct.

>
> - but it's actually a directory that contains both the executable and
>   the resources. Under Windows it is possible to embed resources
>   directly in the .exe -- or for all platforms, you can simply cat it
>   at the end of the .exe with an easy-to-recognize delimiter, as .zip
>   auto-extrators do. The OSX way makes things easier for the
>   programmer (just fopen()).

I'm not sure about what you can and can't do with exe files, but I  
think one of the unique things about bundles in Mac OS X is that you  
can also put dynamic libraries directly inside the bundle which the  
main executable can link against.  I'm not sure if you can put  
dynamic libraries in exe files--I think that would only happen with  
static linking, but I don't know the details of Windows binaries.

>
> - when you drag 'n drop the .app, you actually move a directory, so
>   it's a single operation with a file browser (but you already can do
>   that with most games by moving the installation directory)

Except users like drag 'n drop installation better than they like  
installers, which put files who knows where.  They also know that it  
will be just as easy to uninstall if they so choose: just drag the  
app to the Trash.  I (as a developer) like it because I don't need to  
have an installer or uninstaller.

> - if you got it from a HTTP or FTP website, you'd need to download
>   each and every files from the something.app/ directory. So instead
>   you have to bundle it in a single archive. Apparently OSX apps often
>   come as a .dmg (can it do more than a .zip btw?)

A dmg file is basically an archive format (like tar).  It also  
supports bz2 or gzip compression.  The only thing I can say that's  
interesting about it is that when you open a dmg file, it is mounted  
as a separate file system so your don't have to unarchive everything,  
just drag out whatever you want--but you can do that with zip files  
on Windows, too.


Anyway, my point in brining all this up is that perhaps a similar  
method could be implemented in Windows such that we can have pure  
drag and drop installation, including dynamic libraries, etc.  Sorry  
if this is mostly off-topic for SDL, but I'd love to be able to  
create this kind of installation experience on Windows for my SDL apps.


Cheers,
chaz


More information about the SDL mailing list