<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Dynamic linking vs. "standalone". How does that work? On Posix, with ld, etc.?<br>I understand fully how it works on NT386 and will explain, as a jumping off point<br>for explanation and analogies.<br><br>Windows has "import .libs" and regular old "static .libs".<br>In reality it has import .objs and regular .objs, and a .lib is a collection of .objs,<br>and can contain a mix, but this is not well known. Usually a .lib only has all one type<br>or all the other type. Actually older import .libs are just kind of wierd and drive<br>the linker in odd roundabout ways that end up doing the right thing, I guess<br>without the linker knowing much. Current Cygwin/Mingwin ld/dlltool import libs<br>I think are still odd. And large. And besides, they seem buggy but tht's a tangent.<br>Look at msvcrt.lib. It contains static startup code and imports.<br>There is no seperate crt0.o file on Windows.<br><br>USUALLY people only build one .lib type or another.<br>However the Modula-3 system has a clever innovation. It always builds both.<br>This retains flexibility in how the clients are built.<br>cm3.exe links to m3core/libm3 statically, most other folks dynamically.<br>It is ROUGHLY like so:<br><br> lib /out:foo.lib.sa objects... <br> sa for standalone <br> link /out:foo.dll objects...<br> as a by-product of the link, foo.lib an import .lib is produced<br><br>When you go to link, you give the linker, well, let's say, full paths.<br>To foo.lib or foo.lib.sa, or whatever mix.<br>(or leaf only paths and the LIB environment variable is searched, kind<br>of like $PATH)<br><br>In "Posix" I know there is foo.a and foo.so.<br>But an .so is a .dll. An .a is? Either?<br>And the third one is?<br><br>To some extent, no matter.<br>I THINK it goes like this for Cygwin/MinGWin:<br><br> ar foo.lib.sa objects <br> ld -o foo.dll --out-imlib foo.lib<br><br>but it's not quite working for me currently.<br>I'm backtracking to get to an earlier version of my config file that was.<br> <br>I should probably break down and use dlltool.<br>And I can read the docs, of course. I do so.<br>And search the web.<br>I have avoided using anything that isn't already a configuration variable.<br>That is, I use gcc instead of ld for example.<br>This is dumb of me I realize.<br>ld gave me fits also on MacOSX but on Windows it should be more viable,<br>fewer arcane details as to what to link in. e.g. I believe on "Posix", the entry<br>point of a file is whatever .o is linked first. Chose carefully.<br>On Windows it is seperately specified and the order of the link command doesn't<br>affect it (though still has other subtle affects). And it is usually buried in a .lib,<br>fewer files to chose between.<br><br> - Jay<br /><hr />Share life as it happens with the new Windows Live. <a href='http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008' target='_new'>Start sharing!</a></body>
</html>