Re: Detecting a C translated bound program
OtterDad wrote:
>
> Pete Lomax wrote:
> >
> > OtterDad wrote:
> > >
> > > I have a couple of programs that refuse to behave when bound into C, but
> > > behave just fine when simply bound with the interpreter.
> > > Is there a way I can tell from within the bound program itself if it was
> > > translated into C so I can catch my own mistake prior to deployment?
> >
> > > BTW I'm still using Euphoria Version 2.4.
> > If that last point is unlikely to change, you could use the entry point:
> > }}}
<eucode>
> > cl=command_line()
> > if equal(cl[1],cl[2]) then -- prog is bound or translated
> > fn=open(cl[1],"rb")
> > void = seek(fn,#A8)
> > ep={getc(fn),getc(fn),getc(fn),getc(fn)}
> > close(fn)
> > if equal(ep,{#10,#0F,#03,#00}) then -- Eu 2.4 exw entry point, I think
> > else -- assume eu2c'd
> > </eucode>
{{{
> > The above is completely untested, btw.
> > Alternatively you could try patching a 1 at offset #7F into any .exe you
> > create
> > via eu2c and assume that all versions of eu (/bound files) will have a 0
> > there,
> > or examine the PE headers (I use OllyDebug) and see if there is anything
> > else
> > that sticks out, maybe an EC.LIB section, (I'm guessing now).
> >
> > Regards,
> > Pete
>
> that's more what i was looking for. thanks pete. i'll try it and report back.
>
> Yours, OtterDad
>
> Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford
include Win32lib.ew
without warning
--------------------------------------------------------------------------------
-- Window Window1
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 283, 97, 0,
0 )
--------------------------------------------------------------------------------
object cl, void, ep atom fn
cl=command_line()
if equal(cl[1],cl[2]) then -- prog is bound or translated
fn=open(cl[1],"rb")
void = seek(fn,#A8)
ep={getc(fn),getc(fn),getc(fn),getc(fn)}
close(fn)
if equal(ep,{#10,#0F,#03,#00}) then -- Eu 2.4 exw entry point, I think
warnErr("bound with translator")
else -- assume eu2c'd
warnErr("bound with C")
end if
else
warnErr("executed with translator")
end if
WinMain( Window1,Normal )
on my machine bound with Eu 2.4, and translated using watcom, both bound
programs report Bound with C
Yours, OtterDad
Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford
|
Not Categorized, Please Help
|
|