🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by John T Riedl Tue, 21 Nov 1989 03:10
calling C++ from C
#605
Author: John T Riedl
Date: Tue, 21 Nov 1989 03:10
21 lines
1177 bytes
I need to call a g++ routine from a C routine.  I'm having trouble
getting the constructors for external objects called correctly.  It
works fine for g++-1.35 using the g++ linker, since this linker
manages initialization through symbol "__start" defined in crt0+.o.

Under g++-1.36 initialization is handled differently.  When the
compiler recognizes that it is compiling 'main' it compiles in a call
to __main as the first statement of the procedure.  ___main is defined
in libg++.a(gnulib3.o), and handles calling the constructors.

My problem is finding an elegant method for invoking ___main
correctly.  So far the best I've been able to do is to to explicitly
call ___main from my C main program.

Are there better solutions?

Thanks,
John
-- 
John Riedl
{ucbvax,decvax,hplabs}!purdue!riedl  -or-  riedl@cs.purdue.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads