<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Mika / Daniel:  Thanks for the test info!</DIV>
<DIV> </DIV>
<DIV>Well, based on what ya'll are reporting, I think the problem has to do with the NT386 platform.  I also don't think it has to do necessarily with the source code.  So, there must be something fishy going on in the NT386 world in the linkage step to cause this type of situation when switching between regular and buildstandalone().</DIV>
<DIV> </DIV>
<DIV>Unfortunately, I'm probably not the right person to figure out what is wrong and fix it either.  Hey, but at least I produced a short test program that reproduces the problem.</DIV>
<DIV> </DIV>
<DIV>Maybe Jay or someone can offer another suggestion on how to fix it.</DIV>
<DIV> </DIV>
<DIV>I do know for sure that the TestPixmap program does build and run correctly on cm3 v4.1 for both buildstandalone() and regular.  So, there must be something that has changed since then to cause this behavior.  Maybe there is some different argument set that needs to get passed to the linker.  I don't know.</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy<BR><BR>>>> Mika Nystrom <mika@async.caltech.edu> 1/19/2008 10:41 PM >>><BR><BR>It works great on NT386GNU, PM3/Klagenfurt, as well, without the<BR>build_standalone.<BR><BR>    Mika<BR><BR>"Daniel Alejandro Benavides D." writes:<BR>>--0-1095273535-1200761640=:77597<BR>>Content-Type: text/plain; charset=iso-8859-1<BR>>Content-Transfer-Encoding: 8bit<BR>><BR>>Hi:<BR>>The TestPixmap does show a nice battery on LINUXLIBC6, Ubuntu Gutsy 2.6.22-14-386, 32 bits machine.<BR>><BR>>Thanks<BR>><BR>><BR>>Jay <jayk123@hotmail.com> wrote:    .hmmessage P { margin:0px; padding:0px } body.hmmessage { FONT-SIZE: 10pt; FONT-FAMILY:Tahoma }  I can repro<BR>> the two different behaviors on XP.<BR>> I was going to try on PPC_DARWIN but I guess Tony's info suffices.<BR>>  <BR>> I tried rolling hand.c back to before I changed (months/year ago), since it is involved in bit twiddling, no change, phew.<BR>>  <BR>> Debugging here is a big humungous pain.<BR>> NT386 has good stacks and line numbers, but no locals or type info, I'd really sometime like to get Codeview info into those .objs...I think it<BR>> is documented well enough, but still not necessarily easy, or maybe have a C generating backend partly for this reason (and to bring up more ta<BR>>rgets, using native tools), and function calls in disassembly I think don't resolve; NT386GNU can't yet build this, though it will soon, but I'm<BR>> not familiar with gdb and there appears to be no type info. I'm building m3gdb right now, I don't know if it will work, I hope it has type info<BR>>, and I'm not familiar with the relevant code. In gdb I struggle just to view bytes in memory, add numbers to addresses and see those, etc. I th<BR>>ink for MY problem, I'm going to link in C code to dump the structs. There is tracing code and I enabled it, but even it crashes in Text_Length.<BR>> At least MY problem crashes, hopefully near the problem, whereas your problem goes all the way through to completion with<BR>> no stopping to hint where the problem is. Darn it. :) on the mock rudeness and :( on the lack of a crash.<BR>>  <BR>> You write the bundle out and it matches, so that doesn't rule out bundles as being the problem? (darn)<BR>> And bundles look pretty simple, a bundle is just a generated source file with a constant in it.<BR>> Maybe newline problems? That wouldn't make sense. I just downloaded some program that might let me separately view the ppm, maybe it'll reveal <BR>>something.<BR>>  <BR>> The bad behavior has like regularly spaced solid color veritical bars a few pixels side across the whole picture, and regularly spaced vertical<BR>> stripes from the correct picture alternating with that. Perhaps someone with ppm/bitmap/graphics experience has seen this behavior and it resul<BR>>ts from some common pixmap mismanagement we could look for?<BR>>  <BR>> I have to say this is very surprising.<BR>>  <BR>> I always wondered, and now I pretty much assume -- Modula-3 never imports/exports data in its dynamic linking, right? It alway imports/exports <BR>>functions, right?<BR>> On Windows, functions have an optional optimization, but data must be handled differently at compile time if it is going to be dynamically impo<BR>>rted.<BR>> For functions, if you don't apply the optimization at compile time, the linker will just generate a single instruction thunk instead.<BR>>  <BR>> That is, given a symbol Foo, there is a symbol __imp__Foo that is a pointer to the actual foo in another .dll/.so.<BR>> The loader only patches pointers, one per import if you build your .dll correctly, it doesn't patch instructions or code strewn throughout a .d<BR>>ll, just one contiguous array of pointers. MAYBE they don't have to be contiguous for each .dl you import from.<BR>>  <BR>> That is, if call msvcrt!fopen, msvcrt!fclose, kernel32!Sleep, my .dll/.exe typically has an array:<BR>>  <BR>> pointer to msvcrt!fopen<BR>> pointer to msvcrt!fclose<BR>> null<BR>> pointer to kernel32!Sleep<BR>>  <BR>> But perhaps kernel32.dll's pointers and msvcrt.dll's pointers need not be adjacent.<BR>>  <BR>> So, going back, my point/question is that, if the compiler knows the function is imported, it can call through __imp__Foo instead of calling Fo<BR>>o.<BR>> But if it calls Foo and you import Foo, the linker will create the function Foo that just jmps through __imp__Foo.<BR>> That doesn't work for data though. There's no ability to intervenve like that.<BR>> So for imported data, the compiler must generated a read and dereference of the pointer __imp__Foo for accesses to Foo, if Foo is to be importe<BR>>d.<BR>> Data imports may be faster when appropriate, but for this reason, I'd say they aren't worth it.<BR>> And for this reason, I HOPE Modula-3 never imports/exports data.<BR>>  <BR>> Oh, you could, for data, always reference the pointer __imp_Foo, and if non materializes, create one.<BR>> However that would suck perf in order to make an uncommon case work.<BR>> I hope Modula-3 doesn't do that either. :)<BR>> Though I guess since this global data in question...maybe it is rare???<BR>>  <BR>> Later,<BR>>  - Jay<BR>><BR>><BR>>  <BR>>---------------------------------<BR>> <BR>> > From: hosking@cs.purdue.edu<BR>>> Date: Sat, 19 Jan 2008 03:09:47 -0500<BR>>> To: rcoleburn@scires.com<BR>>> CC: m3devel@elegosoft.com<BR>>> Subject: Re: [M3devel] pixmap problem<BR>>> <BR>>> Looks fine to me on I386_DARWIN.<BR>>> <BR>>> On Jan 19, 2008, at 12:31 AM, Randy Coleburn wrote:<BR>>> <BR>>> > <TestPixmap.zip><BR>>> <BR>><BR>><BR>><BR>>---------------------------------<BR>>Need to know the score, the latest news, or you need your Hotmail«-get your "fix" Check it out.<BR>><BR>>       <BR>>---------------------------------<BR>><BR>>Web Revelaci?n Yahoo! 2007:<BR>> Premio Favorita del P?blico - íVota tu preferida!<BR>>--0-1095273535-1200761640=:77597<BR>>Content-Type: text/html; charset=iso-8859-1<BR>>Content-Transfer-Encoding: 8bit<BR>><BR>>Hi:<br>The TestPixmap does show a nice battery on LINUXLIBC6, Ubuntu Gutsy 2.6.22-14-386, 32 bits machine.<br><br>Thanks<br><br><br><b><i>Jay &l<BR>>t;jayk123@hotmail.com&gt;</i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-lef<BR>>t: 5px;">   <style> .hmmessage P { margin:0px; padding:0px } body.hmmessage { FONT-SIZE: 10pt; FONT-FAMILY:Tahoma } </style> I can repro the two<BR>> different behaviors on XP.<br> I was going to try on PPC_DARWIN but I guess Tony's info suffices.<br> &nbsp;<br> I tried rolling hand.c back to<BR>> before I changed (months/year ago), since it is involved in bit twiddling, no change, phew.<br> &nbsp;<br> Debugging here is a big humungous&nb<BR>>sp;pain.<br> NT386 has good stacks and line numbers, but no locals or type info, I'd really sometime like to get Codeview info into those .objs.<BR>>..I think it is documented well enough, but still not necessarily easy, or maybe have a C generating backend partly for this<BR>> reason (and to bring up more targets, using native tools),&nbsp;and function calls in disassembly I think don't resolve; NT386GNU can't yet bui<BR>>ld this, though it will soon, but I'm not familiar with gdb and there appears to be no type info. I'm building m3gdb right now, I don't know if <BR>>it will work, I hope it has type info, and I'm not familiar with the relevant code. In gdb I struggle just to view bytes in memory, add numbers <BR>>to addresses and see those, etc. I think for MY problem, I'm going to link in C code to dump the structs. There is tracing code and I enabled it<BR>>, but even it crashes in Text_Length. At least MY problem crashes, hopefully near the problem, whereas your problem goes all the way through to <BR>>completion with no stopping to hint where the problem is. Darn it. :) on the mock rudeness and :( on the lack of a crash.<br> &nbsp;<br> You wri<BR>>te the bundle out and it matches, so that doesn't rule out bundles as being the problem? (darn)<br> And bundles look pretty<BR>> simple, a bundle is just a generated source file with a constant in it.<br> Maybe newline problems? That wouldn't make sense.&nbsp;I just downl<BR>>oaded some program that might let me separately view the ppm, maybe it'll reveal something.<br> &nbsp;<br> The bad behavior has like regularly s<BR>>paced solid color veritical bars a few pixels side across the whole picture, and regularly spaced vertical stripes from the correct picture alte<BR>>rnating with that. Perhaps someone with ppm/bitmap/graphics experience has seen this behavior and it results from some common pixmap mismanageme<BR>>nt we could look for?<br> &nbsp;<br> I have to say this is very surprising.<br> &nbsp;<br> I always wondered, and now I pretty much assume -- Mo<BR>>dula-3 never imports/exports data in its dynamic linking, right? It alway imports/exports functions, right?<br> On Windows, functions have an op<BR>>tional optimization, but data must be handled differently at compile time if it is going to be dynamically imported.<br> For<BR>> functions, if you don't apply the optimization at compile time, the linker will just generate a single instruction thunk instead.<br> &nbsp;<br<BR>>> That is, given a symbol Foo, there is a symbol __imp__<font face="">Foo</font> that is a pointer to the actual foo in another .dll/.so.<br> Th<BR>>e loader only patches pointers,&nbsp;one per import if you build your .dll correctly, it doesn't patch instructions or code strewn throughout a <BR>>.dll, just one contiguous array of pointers. MAYBE they don't have to be contiguous for each .dl you import from.<br> &nbsp;<br> That is, if cal<BR>>l msvcrt!fopen, msvcrt!fclose, kernel32!Sleep, my .dll/.exe typically has an array:<br> &nbsp;<br> pointer to msvcrt!fopen<br> pointer to msvcrt<BR>>!fclose<br> null<br> pointer to kernel32!Sleep<br> &nbsp;<br> But perhaps kernel32.dll's pointers and msvcrt.dll's pointers need not be adjacent<BR>>.<br> &nbsp;<br> So, going back, my point/question is that, if the compiler knows the function is imported, it can call<BR>> through __imp__Foo instead of calling Foo.<br> But if it calls Foo and you import Foo, the linker will create the function Foo that just jmps t<BR>>hrough __imp__Foo.<br> That doesn't work for data though. There's no ability to intervenve like that.<br> So for imported data, the compiler mus<BR>>t generated a read and dereference of the pointer __imp__<font face="">Foo for accesses to Foo, if Foo is to be imported.</font><br> Data import<BR>>s may be faster when appropriate, but for this reason, I'd say they aren't worth it.<br> And for this reason, I HOPE Modula-3 never imports/expo<BR>>rts data.<br> &nbsp;<br> Oh, you could, for data, always reference the pointer __imp_Foo, and if non materializes, create one.<br> However that <BR>>would suck perf in order to make an uncommon case work.<br> I hope Modula-3 doesn't do that either. :)<br> Though I guess since this global data<BR>> in question...maybe it is rare???<br> &nbsp;<br> Later,<br> &nbsp;- Jay<br><br><br>  <hr id="stopSpelling"> <br> &gt; From:<BR>> hosking@cs.purdue.edu<br>&gt; Date: Sat, 19 Jan 2008 03:09:47 -0500<br>&gt; To: rcoleburn@scires.com<br>&gt; CC: m3devel@elegosoft.com<br>&gt; <BR>>Subject: Re: [M3devel] pixmap problem<br>&gt; <br>&gt; Looks fine to me on I386_DARWIN.<br>&gt; <br>&gt; On Jan 19, 2008, at 12:31 AM, Randy Col<BR>>eburn wrote:<br>&gt; <br>&gt; &gt; &lt;TestPixmap.zip&gt;<br>&gt; <br><br><br><hr>Need to know the score, the latest news, or you need your Hotm<BR>>ail«-get your "fix" <a href="http://www.msnmobilefix.com/Default.aspx" target="_new">Check it out.</a></blockquote><br><p>&#32;<BR>><BR>><BR>>      <hr size=1><br><font face="Verdana" size="-2">Web Revelaci?n Yahoo! 2007:<br> Premio Favorita del P?blico - <a href="http://es.promotions.ya<BR>>hoo.com/revelacion2007/favoritos/">íVota tu preferida!</a></font><BR>>--0-1095273535-1200761640=:77597--<BR><BR></DIV></BODY></HTML>