* Updated examples (compilation flags, coding style)

git-svn-id: svn://svn.zoy.org/elk/trunk@69 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-02 23:23:17 +00:00
parent 230f3fc843
commit af3ee62078
2 changed files with 9 additions and 7 deletions

View File

@ -9,7 +9,7 @@ See constructor.cpp in this directory for compilation instructions.
Here is a transcript showing a test run under Linux using the
GNU g++ compiler:
% g++ -shared -fPIC -I/usr/include/elk class.cpp -o class.so -lelk
% g++ -shared -fPIC class.cpp -o class.so -lelk
%
% scheme
> (load 'class.so)
@ -45,7 +45,7 @@ void foo::write_val(int newval) {
/* ---------------------------------- */
#include "scheme.h"
#include <elk/scheme.h>
struct S_Foo {
Object tag; class foo foo;

View File

@ -5,11 +5,11 @@ are invoked by Elk when loading a compiled C++ file (when exiting).
o Compile the shared object, for instance:
CC -pic -shared -I/usr/elk/include constructor.cpp -o constructor.so -lelk
CC -pic -shared constructor.cpp -o constructor.so -lelk
or:
g++ -fPIC -shared -I/usr/include/elk constructor.ppc -o constructor.so -lelk
g++ -fPIC -shared constructor.ppc -o constructor.so -lelk
o Now "(load 'constructor.so)", observe the "invoking constructor" message,
and evaluate "(test)", which should return 3. Terminate the interpreter
@ -36,7 +36,7 @@ o If static constructors don't get called when loading compiled C++ files,
----------------------------------------------------------------------*/
#include "scheme.h"
#include <elk/scheme.h>
#include <iostream>
@ -47,7 +47,9 @@ public:
std::cerr << "[invoking constructor]" << std::endl;
i = 3;
}
~C() { std::cerr << "[invoking destructor]" << std::endl; }
~C() {
std::cerr << "[invoking destructor]" << std::endl;
}
};
C c;