<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><div style="text-align: left;">Nevermind, I'll figure it out.<br>I am going to try dlltool.<br>Currently it SEEMS like references are to _Foo but defintions are Foo.<br>Of course, leading underscores always confuse. Sometimes they are added, sometimes they are removed, sometimes they must match. It stinks a little bit. At least on x86 Windows. Usually it is well hidden. COULD be a disagreement between Cygwin cm3cg and mingwin as/ld..though given that things were working..I don't know. I should try the mingwin sh/make/sed...<br><br> - Jay<br></div><blockquote><hr id="EC_stopSpelling">From: jayk123@hotmail.com<br>To: m3devel@elegosoft.com<br>Date: Sun, 13 Jan 2008 23:43:41 +0000<br>Subject: [M3devel] dynamic linking, stanalone()?<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass EC_body.hmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
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="_blank">Start sharing!</a>
</blockquote><br /><hr />Put your friends on the big screen with Windows Vista® + Windows Live™. <a href='http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_012008' target='_new'>Start now!</a></body>
</html>