<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><BLOCKQUOTE>
I'm still torn over that any NT386 target could<BR> have a choice of three threading models (win32, pthread, vtalarm), two<BR> windowing libraries (ms, x), two (three) compilers (ms, mingwin, cygwin), two (three) linkers (ms, mingwn, cygwin), various runtimes (msvc various versions, cygwin, mingwin (discouraged)) etc.<BR>
<BR>
Appending a short string of unreadable bits to BUILD_DIR is <EM>very tempting</EM><BR>in order to easily generate and test the combinatorial possibilities.<BR>
<BR>
backend: 0 integrated, 1 gcc<BR> already a setting (with four values) <BR>
<BR>
ccompiler/linker: 0 ms, 1 gcc<BR> (these could be split, and could allocate more bits...)<BR> maybe 00 ms, 01 cygwin, 10 ming <BR> maybe define enum up front that allows for watcom, metrowerks, digitalmars, llvm etc.<BR>
maybe use a decimal digit for all these, and 0 is reserved, maybe.<BR>
<BR>
threading: 0 win32, 1 pthreads<BR> drop vtalarm, or use two bits?<BR>
<BR>
windowing: 0 ms, 1 x<BR>
<BR>
cruntime: 0 ms, 1 cyg<BR> There is also a ming runtime, discouraged<BR> There also really N ms runtimes, ming offers several:<BR> msvcrt.dll, msvcr70.dll, msvcr71.dll, msvcr80.dll, msvcr90.dll...<BR> but jmpbuf presumbly doesn't change<BR> again could allocate multiple bits..<BR>
<BR>
cruntime I guess determines oSTYPE Win32 or Posix, though<BR>it loses its meaning mostly, and X vs. not-X is usually decide the same...<BR>
<BR>
The three most common combinations:<BR> 00000 -- NT386<BR> 11111 -- NT386GNU<BR> 11000 -- NT386MINGNU<BR>
<BR>
but several others would work<BR> 11101 -- cygwin with native windowing<BR> 11011 -- cygwin with native threads<BR> 11001 -- cygwin with native threads and native windowing<BR>
<BR> <BR>BUILD_DIR would be NT386-$(config)<BR>as a special case perhaps, the three common<BR>cases could be translated to the above strings.<BR>
<BR>
But the underlying implementation would be a few bools/enums,<BR>and iterating through them would be easy, while special casing<BR>and skipping deemed invalid combinations, like ms runtime and pthreads,<BR>and possibly ms runtime and x windows.<BR>
Really, it might surprise folks, but really, basically every single combination works.<BR>
Compilers are very independent of headers and libs and headers and libs are very independent of compilers, aside from a few language extensions like __stdcall. You can generally mix runtimes in the same process, just as you can mix them on the same machine, you just need to be careful about what you pass to what. If you call fopen, be sure pass the result back to the matching fclose, malloc/free, etc. Startup code, to the extent that it matters, might be a problem, but really, just avoid C++ globals with constructors/destructors anyway, they are always a problem. Modula-3 has its own startup code, and if you were to write "main" in C and link in Modula-3 static .libs, that probably doesn't work...might <EM>actually </EM>be better to play into whatever the platform's C++ constructor story is, as problematic as they (probably always?) are -- i.e. unpredictable/hard-to-control ordering.<BR>
<BR>
(bad editing...and maybe use hex for compression..)<BR>
<BR>
Bringing back cminstall is almost interesting, to prompt<BR>the user, or probe their system, though Quake/cm3 can probe at runtime.<BR>if os == windows_nt<BR> system_cc | findstr version | findstr gcc<BR> else system_cc | findstr visual c++<BR>else<BR> system_cc | grep version | grep gcc<BR> else system_cc | grep visual c++<BR>end<BR>
<BR>
inefficient.<BR>
<BR>
anyway, I'll merge current NT386GNU into NT386 and make it chose<BR>how to compile/link which are the main variables today.<BR>
and then decide about cygwin, but probably do like the above, since<BR>it'll totally share code with NT386 except the naming conventions<BR>and the removal of the -mno-cygwin switch..<BR>
<BR>
I <EM>know </EM>this <EM>seems </EM>overly complicated, but it should be exposable<BR>easily enough to users by hiding the choices, presenting three basic ones,<BR>and still allow all the obvious and perhaps useful knobs, and iterating through<BR>the combinations, without creating a combinatorial explosion of source files<BR>or Modula-3 or Quake code.<BR>
<BR> ...Jay<BR></BLOCKQUOTE>
<BLOCKQUOTE>
<HR id=EC_stopSpelling>
From: jayk123@hotmail.com<BR>To: m3devel@elegosoft.com<BR>Date: Tue, 22 Jan 2008 10:48:56 +0000<BR>Subject: Re: [M3devel] platform/build_dir is a big tuple?<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass EC_body.hmmessage
{font-size:10pt;font-family:Tahoma;}
</STYLE>
Final answer?<BR> <BR>I played around with this but just can't accept platforms/build_dirs like:<BR> ntx86msmsmscm3msn<BR> ntx86gccgcccm3cgmsn<BR> ntx86gccgcccm3cgxn<BR> ntx86-gggggmn<BR> ntx86-ggixn<BR> ntx86_mmmimm<BR><BR>Ok, I have one more name here, and then a bit of a change, or<BR> a stronger statement of something I had already said.<BR><BR>NT386MINGNU<BR><BR>Ok, I think we (me!) are confusing host and target, MOSTLY.<BR><BR>And cm3 might not have them quite divided appropriately.<BR><BR>What is a "host"? What is a "target"?<BR><BR>MinGWin and Visual C++ output similar results, targeting<BR>the same runtime (usually), threading library, windowing library.<BR>There is a chance for exception handling to diverge however.<BR>Well, speaking of Visual C++ the C/C++ compiler and MinGWin<BR>the gcc environment, yes, very different, not interoperable.<BR>MinGWin uses what gcc calls "sjlj" -- setjmp/longjmp exceptions.<BR>Very inefficient. But heck, gcc doesn't support __try/__except/__finally,<BR>only C++ exceptions, and interop of C++ is often not great,<BR>what with name mangling and all.<BR><BR>NT386GNU's OUTPUT uses a different runtime, unless you<BR> trim dependencies, possibly a different threading library,<BR> possibly a different windowing library. All this probably<BR> configurable. Again exception handling is a sore point in<BR> that it is the primary C runtime dependency of Modula-3.<BR> If you use Cygwin but say -mno-cygwin, that means<BR> you are targeting NT386. (and don't use pthreads or X Windows;<BR> behavior of exceptions/setjmp/longjmp TBD -- really, need<BR> to not use the -mno-cygwin headers in that case; I'll check).<BR><BR>Perhaps m3core.dll should export m3_setjmp/m3_longjmp..<BR><BR>Either one can do a cross build to the other.<BR>Two cm3.exes, two sets of outputs, that either can produce.<BR><BR>NT386 can use gcc or the integrated backend.<BR> And the gcc it uses can be MinGWin or Cygwin. (theoretically and probably soon reality)<BR> <BR>NT386GNU can use either as well! (also currently theory, but a real possibility)<BR> It isn't GNU tools, it is GNU runtime.<BR><BR>One small area with cm3 might fall down just slightly is that of<BR> cross builds where host and target have different naming conventions.<BR> -lfoo vs. foo.lib, foo.o vs. foo.obj are an aspect of the host and<BR> I vaguely recall that cm3 ties naming convention to ostype.<BR> The appending of .exe is a target characteristics, but the others are not really.<BR> Naming convention is really a host thing and not a target thing.<BR><BR>The config files are a mix of host and target information, mostly actually host,<BR> except for the one line that says TARGET. Most of the target variation is in cm3,<BR> which always can do any, and cm3cg (which might be nice to be similar, but that's<BR> another matter and not likely to ever change, except when AMD64 is the last<BR> architecture standing. :) )<BR><BR>If Windows had "rpath", then SL would be split between HOST_SL and TARGET_SL.<BR>As it stands, SL is HOST_SL.<BR><BR>Consider as well the various versions of Visual C++.<BR>They output mostly the same, very interoperable.<BR><BR>Consider optimization switches. Host or target?<BR>Consider version of gcc or Visual C++? Host or target?<BR>Well, inevitably, the host has an affect on the target.<BR> If not the for the host, the target would not even exist.<BR> Bugs in the host produce bugs in the target.<BR> etc.<BR><BR>(And realize that Cygwin runs on top of an OS built with<BR>a Microsoft compiler, so really there is interop, but sometimes through a layer.)<BR> <BR>So there's a risk of saying there is six+ combinations.<BR>(host cygwin, host mingwin, host native) x (target nt386, target nt386gnu) <BR> <BR>But generally the host is assumed not a factor.<BR> <BR>I guess "LIBC" could be seperated into several options...<BR>You could actually have code that needs one runtime or another, and they could<BR>link together, depending on what they do..<BR> <BR>This is something I don't know if cm3 handles, or anything I have seen.<BR> I should be able to build a static .lib, that includes some C code, that imbues its<BR> clients with build time dependencies. Well, I guess #pragma comment(linker) is this.<BR><BR>So the next tasks are roughly:<BR> Merge my NT386 and NT386GNU files.<BR> Switching on a variable such as backend mode.<BR> <BR> Introduce a "new" (old) NT386GNU file, perhaps more like what was already there.<BR> <BR> Change NT386GNU back to Posix.<BR> <BR> Build NT386GNU.<BR> <BR>oh, one more point...while these are two targets from cm3's point of view, they are PROBABLY the same target to cm3cg<BR>and so only one is needed. I have to check if configure differentiates between i686-pc-cygwin and i686-pc-mingwin...<BR>but I guess it should...<BR>It might actually be profitable to have two bloated cm3cg.exe's.<BR>And they should ship to \cm3\pkg\m3cc\target\host or host\target and cm3 should know which to run.<BR>Blech..four of them when one would suffice?<BR>The detail being mainly what the paths to .libs look like, unfortunate.<BR>Possibly cm3 can bridge this gap using that "broken" feature that symlinks libs into the target directory,<BR>using NTFS hard links, if installroot and root are on the same volume... (or symlinks on Vista).<BR>Or maybe convert the paths as appropriate, hacky, but saves an extra cm3cg.exe which is good to avoid.<BR> <BR>(all the more reason to lump all targets into one file, so that the host x target matrix collapses to just one axis, host; and<BR>then you can write stuff in Perl/Python/Java/C# to collapse that to just one, except for the underlying runtime/interpreter...)<BR> <BR>Oh, cm3cg isn't the issue. It is always sitting in the correct directory and reads one file and writes one file, no slashes.<BR>The issue is gcc as the linker. Again, this is a host issue..and cm3 or the config file definitely should do the translation.<BR> <BR> - Jay<BR><BR>
<BLOCKQUOTE>
<HR id=EC_EC_stopSpelling>
From: jayk123@hotmail.com<BR>To: m3devel@elegosoft.com<BR>Date: Mon, 21 Jan 2008 23:01:44 +0000<BR>Subject: [M3devel] platform/build_dir is a big tuple?<BR></BLOCKQUOTE><BR>
<HR>
Need to know the score, the latest news, or you need your Hotmail®-get your "fix". <A href="http://www.msnmobilefix.com/Default.aspx" target=_blank>Check it out.</A> </BLOCKQUOTE><br /><hr />Climb to the top of the charts! Play the word scramble challenge with star power. <a href='http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan' target='_new'>Play now!</a></body>
</html>