Yet more OPTLINK woes

Daniel Keep daniel.keep.lists at gmail.com
Thu May 13 01:39:05 PDT 2010


Some general replies:

There have been three responses along the lines of "are you sure OPTLINK
is running?".  Quoting myself:

"Invoking OPTLINK directly changes nothing."

Or to be more specific:

> link AstTest,AstTest,,user32+kernel32/noi+tango.lib;
(zero-byte .map file pops into existence)

Yes, I'm sure.  I'm also sure it's the DigitalMars link.exe and in the
correct directory.

> I've had problems before with DMD silently exiting without an error
> message and with error success and leaving behind a corrupt .obj.

I had a look at the .obj file (I actually used lib to stuff it into a
.lib file and then dump the symbols), and it looked fine.

Well, except for this:

_D11TokenStream<80><8d><8d>5_ctorMFC6Source<f6>P<80><90><91>
  DFS8Location<80><89><89>AaYvJS6<80><85><cf>s5<f4>Zb<80>
  <99><aa>ZC<81><9a><87>

(broken across 3 lines; <xx> are bytes in hex since several of them were
non-printable.)

The same had happened to a number of symbols from tango.io.stream.Format.

In the case of the first one, the appropriate declarations (with
fully-qualified module name commented) are:

> final class /*TokenStream.*/TokenStream
> {
>     alias bool function(Source, LocErr, out Token) NextToken;
>     this(Source src, NextToken next, LocErr err) { ... }
> }
>
> final class /*Source.*/Source { ... }
>
> alias void delegate(Location, char[], ...) /*Location.*/LocErr;
>
> struct /*Location.*/Location { ... }

As far as I understand D's name mangling, that symbol name is corrupt.

> CTFE recursion is the only reported unfixed bug that does that ...

There is exactly one CTFE function that calls itself.  However, it
cannot recurse more than once (it does so to change types) *and* this
function is used in the LexerTest program which does compile.

AstTest uses an additional CTFE function, but this just concatenates
some strings together.

> Try and remove stuff until it starts working

I've gutted the changes between LexerTest and AstTest to the point that
I get an .exe.  This involved stripping out more or less every global
and member function that was added and every derived class.

What tipped it over into compiling was removing the reference to
StructuredOutput from AstDumpVisitor.  Which is odd, because
StructuredOutput is still being used in AstTest.

StructuredOutput, once gutted, is this:

> module StructuredOutput;
>
> import tango.io.model.IConduit : OutputStream;
> import tango.io.stream.Format : FormatOutput;
>
> final class StructuredOutput
> {
>     alias StructuredOutput This;
>     this(OutputStream os)
>     {
>     }
> }

I honestly can't see what it could be upset about.

> Post the source and I'll try to help. I like debugging weird problems.
> :)

Attached both regular and decaffeinated^Hgutted versions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matheval.7z
Type: application/octet-stream
Size: 9747 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100513/bd83e159/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matheval-gutted.7z
Type: application/octet-stream
Size: 9715 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100513/bd83e159/attachment-0003.obj>


More information about the Digitalmars-d-learn mailing list