Terry Lambert wrote:
> Kris Kennaway wrote:
> > How does one fix this in a library?  I've been moving the
> > initialization to main() for applications.
> Use assembly glue to put it in a linker set that gets pulled
> in by the .init code.
> This will only work for user space code, since it depends in
> the crt0 treating it like a C++ binary (linker sets are a C++
> feature which FreeBSD uses all over anyway).

Realizing that I think this is the wrong way to fix this problem,
add the following to your library:

        #include <sys/linker_set.h>

        static void
                ...     /* my crap */
        TEXT_SET(__CTOR_LIST__, run_before_main);

If you want something run on rundown, use:

        TEXT_SET(__DTOR_LIST__, run_after_main);

(or just use atexit(3), if you can live with the registration
polluting your source code).

Doing the code this way will guarantee that your code will
work on any FreeBSD supported platform where C++ works.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to