<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>.dll Vs .so</title>
		<link>http://www.allegro.cc/forums/view/478575</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 16 Apr 2005 00:29:34 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,<br />I know how to handle .dll of liballegro (alleg42.dll and so on)<br />1) it is create while building allegro<br />2) it can be distributed along with the program (in same directory as .exe)<br />3) or probably it can be in some... WINDOWS/system32/ (like c:/windows/system32/) direcotry, right?</p><p>and what aobut linux version of .dll - the *.so files?<br />1) they are also build while compiling the allegro library<br />2) how should I run distrbitue them along (assuming I realy want this, since my program is close-source, and I do not want to install liballeg in entire system, and so on)? IF I just copy *.so to sam directory when executable is, it dont work. How exacly should I startup an executable ./foobar telling it to look for SO libraries in &quot;./&quot; or in &quot;./libs/linux/&quot; and so on?<br />3) what was again that thingy to make SO installed globally in system? write some patch to some file and call ldconfig...?<br />4) what are usefull tools on that subject (like - how to check with exacly SO files are beeing used/needed)?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf256)</author>
		<pubDate>Fri, 08 Apr 2005 19:53:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think it&#39;s better to just statically link with Allegro and everything else that you need to. The downside is that your executables will be huge, but at least you&#39;re almost guaranteed they&#39;ll work everywhere...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Fri, 08 Apr 2005 20:14:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I wonder.. Isn&#39;t just a dll the same as static linking, but it is ripped out of the exe and placed in it&#39;s own file?</p><p>EDIT: I mean, won&#39;t the dll be as huge as the exe file would have been when static linked?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Avenger)</author>
		<pubDate>Fri, 08 Apr 2005 20:17:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>But the user needs only to download the DLL once.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Fri, 08 Apr 2005 22:00:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>When static linking, some parts of Allegro is left out if it&#39;s not used (code wise) so the exe would be smaller than a dll/exe combo. But if your program is going to have more than one exe for whatever reason (like a separate map editor, and other tools) then the dll/exe combo will be smaller space wise.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (MiquelFire)</author>
		<pubDate>Fri, 08 Apr 2005 22:14:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>I wonder.. Isn&#39;t just a dll the same as static linking, but it is ripped out of the exe and placed in it&#39;s own file?</p></div></div><p>
No. Parts of a DLL/shared lib are put into shared memory space, so multiple processes can access the same memory area (smaller footprint and nice on CPU cache). However, if it&#39;s just a single process at the time, then I don&#39;t think there&#39;d be a difference memory-wise.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>When static linking, some parts of Allegro is left out if it&#39;s not used (code wise) so the exe would be smaller than a dll/exe combo.</p></div></div><p>
That&#39;s not true anymore. Since you can dynamicly load the exe itself, the linker can&#39;t assume that unused code not directly referenced won&#39;t be used indirectly (ie. dlopen the running program and dlsym to grab any function/variable you want). UPX, at it&#39;s highest setting, will strip out unused code though, IIRC.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 09 Apr 2005 01:04:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>1) they are also build while compiling the allegro library</p></div></div><p>
Depends. You can build a static version of Allegro, in which case you don&#39;t get the shared objects.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>2) how should I run distrbitue them along</p></div></div><p>
As a rule of thumb, you don&#39;t. If you do though, they should <i>probably</i> go to /usr/local/lib and be properly symlinked. I&#39;m not familiar with the detailed conventions on this, you can probably google for it.<br />But again, as a rule of thumb, don&#39;t.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>IF I just copy *.so to sam directory when executable is, it dont work. How exacly should I startup an executable ./foobar telling it to look for SO libraries in &quot;./&quot; or in &quot;./libs/linux/&quot; and so on?</p></div></div><p>
Some clarification: the programme isn&#39;t normally the one who does the loading of shared object files, that&#39;s the job of the programme that launches your programme, the loader ld (yes, the same one you use to link your programmes).<br />The loader looks in several locations preset in ld.so.conf. As a normal user you cannot alter this, so you need to be root to do that.  For programmes I personally consider it bad form to do this anyway (I prefer it creates symlinks in /usr/lib or something like that).<br />In addition to this, the loader checks the directories listed in the LD_LIBRARY_PATH environment variable. For instance, doing <i>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib</i> will add the user&#39;s personal lib directory to the search path. This should be your prefered way to tell the loader where to find the files. Just have a line like that and a call to the executable of your programme in a shellscript and you should be fine.<br />This method has the advantage that the programme can be installed by a normal user on his or her own account.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>3) what was again that thingy to make SO installed globally in system? write some patch to some file and call ldconfig...?</p></div></div><p>
Make sure the directory is in /etc/ld.so.conf and run ldconfig. Again, I consider this rather bad form personally and it makes it impossible for a normal user to install the programme.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>4) what are usefull tools on that subject (like - how to check with exacly SO files are beeing used/needed)?</p></div></div><p>
ldd.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sat, 09 Apr 2005 01:48:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is is possible to just make an archive of all of the so files required by a program and distribute that as well?  Would the program be able to find the files in its own directory or would they have to be moved/copied somewhere?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dark Nation)</author>
		<pubDate>Fri, 15 Apr 2005 22:11:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Would the program be able to find the files in its own directory or would they have to be moved/copied somewhere?</p></div></div><p>
If you start the program with a script that modifies LD_LIBRARY_PATH (I think? maybe it&#39;s something else..), then calls the real executable, it should work fine. And as long as you start a script with <span class="source-code"><span class="p">#!/bin/sh</span></span> or some other shell, the modified var will only be modified inside the script (eg. the rest of the system will be unaffected).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 16 Apr 2005 00:29:34 +0000</pubDate>
	</item>
</rss>
