users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Always the problem between gplc/gcc--obj_chain and initialization


From: Timo Karjalainen
Subject: Re: Always the problem between gplc/gcc--obj_chain and initialization
Date: Fri, 30 Aug 2002 17:12:00 +0300 (EEST)

On Fri, 30 Aug 2002 address@hidden wrote:

> On Friday, August 30, 2002, at 06:26  AM, Timo Karjalainen wrote:
>
> > Reflecting on the obj_chain_* stuff you quoted, it seems like there is
> > some wacky symbol-address scheme. What else are those magic numbers good
> > for except scanning the binary and forking all user code between the
> > beginning and the end.
>
> This is how the initialization/1 directive is implemented.

Oh, I see. Rather than collecting them link-time, they are left scattered
around the executable and then at startup, found and processed.

So unless one uses the initialization directive, one should be able to
just leave out any obj_chain_* stuff and be happy? Even if GNU Prolog
still scans the whole executable, it just won't find anything.

As far as I've found out, the only way to get a stand-alone GNU Prolog
program to start right away (like C programs calling main()) is to use
an initialization directive to specify a "main predicate".

But if one's main program is in C, and initialization isn't otherwise
used, one should be able to throw away these obj_chain_*'s?

> I don't know if this counts as a "wacky symbol-address scheme",

Yes, it does in my eyes. :-) I was referring exactly to techniques based
on walking the executable binary.

> but it is an unusual architecture and it complicates incorporating
> gprolog into a larger system.

Amen.


Is there a way to suppress this obj_chain stuff in GNU Prolog? If one has
a C main() and doesn't use the initialization directive, these symbols
shouldn't be necessary. Also suppressing the search would speed up program
start up.


-- 
Timo Karjalainen             "I don't have a life.
                              I have a program."
                                   - Star Trek: Voyager






reply via email to

[Prev in Thread] Current Thread [Next in Thread]