Compilation strategy

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Dec 16 23:00:12 PST 2012


On Sun, Dec 16, 2012 at 10:27:31PM -0800, Jonathan M Davis wrote:
> On Sunday, December 16, 2012 19:18:45 Walter Bright wrote:
[...]
> > Whether the file format is text or binary does not make any
> > fundamental difference.
> 
> If the entire .d file is there in binary form, then I don't see why it
> wouldn't work. .di files fail because they strip out the
> implementation. If a binary format were used, then we should be able
> to get away with keeping the implementation there, because then it's
> obfuscated rather than for sitting there for all to see, which is why
> corporations and the like insist on distributing only headers. Even
> with an object file, the best that you get is obfuscation, because it
> can always be reverse engineered, so it seems to me that what needs to
> be avoided is providing text. As long as we use text, we're forced to
> cut out the implementation and end up crippling any code that uses
> that module, since it can't inline it or use it in CTFE. In binary
> format, it's obfuscated, so the entire implementation can be there,
> allowing inlining and CTFE to work.
[...]

>From a computer-theoretical point of view, whether you use a plaintext
.d file or a partially-compiled interface file makes no difference at
all, because they are all representations of the same thing. But from a
practical standpoint, some PTBs may feel more comfortable with a binary
blob that's not obviously readable to the casual onlooker.

Of course, that provide zero theoretical security, because anyone who's
desperate enough to reverse-engineer your library will do it even if
they only have the final executable. But the casual onlooker factor is
not to be dismissed when dealing with management types. So I contend
that precompiling to some kind of IR is of some practical value, even if
in theory it's not worth very much. (Yes decompilers and what-not will
always be there. That didn't stop Java developers from preferentially
shipping .class files vs. .java files. You can't stop the professionals,
but you can at least stop the petty thieves. This can be important to
some people.)


T

-- 
The fact that anyone still uses AOL shows that even the presence of options doesn't stop some people from picking the pessimal one. - Mike Ellis


More information about the Digitalmars-d mailing list