[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Aug 8 23:08:37 1998 
Subject:Re: C++ and pop11 
From:David Whitten 
Volume-ID:980809.01 

Stuart I Reynolds <S.I.Reynolds@cs.bham.ac.uk> wrote:
: I recently tried linking pop11 to C++ to make use of a nice C++
: interface I have for gnuplot. However, although I managed to get pop11
: to load up C objects and call C functions - it fails completely if these
: functions make use of the C++ standard libraries.
: Does anyone know if there's an (easy) way to fix this (its not
: desperately important for me that it works)?

Well, I seem to remember that you can put extern "C" in front
of a C++ function name and it doesn't do the name mangling.
Of course, I don't know if that means you can't write C++ code in
the function, but I think it is just talking about what name the
linker will see.

: I also tried loading up the C++ standard libraries but POP11 doesn't
: seem to like the format. I assume the problem is that POP11 can only
: import object files with C name mangling which I guess the C++ object
: files don't have. 


: If I try to load the C++ stanard objects I get lots of errors of the
: sort:
: ;;; Warning - ld.so.1: pop11: fatal: relocation error: file
: ./iostream.so: symbol get__7istreamPcic: referenced symbol not found
: and then 
: ;;; Error - ld.so.1: pop11: fatal: hello: can't find symbol
: ;;; MISHAP - ERRORS ACCESSING EXTERNAL SYMBOLS (see above)
: ;;; FILE     :  /scratch/pg/sir/cppio/test.p   LINE NUMBER:  80
: ;;; DOING    :  external_do_load exload trycompile 
: --
: exload 'test2'
:   ['test.so',      ;;;A program with a C interface that calls C++ fns
:    'iostream.so',  
:   .
:   . lots of other C++ libraries
:   .
:   ]
:   (language C)
:     c_hello():void <- hello   ;;; makes use of C++ streams
: endexload;
: exacc c_hello();
: --



: Stuart.
: PS. What's the difference between a .o and .so file? (I tried various
: combinations with different file names)

a .so file is statically linked, I think. and a .o file is dynamically
linked.  So a statically linked file is one that provides a shared 
library so code doesn't have to be duplicated in each .exe created.
Of course, I could be confused about this, but I think this is right.

David (whitten@netcom.com)