test cases for dynamically loaded objects: constructor/destructor call for

static objects, C++ runtime support
This commit is contained in:
drochner 2000-12-08 19:21:28 +00:00
parent aa2b1723f5
commit 08a3f0ae6e
4 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,29 @@
# $NetBSD: Makefile,v 1.1 2000/12/08 19:21:28 drochner Exp $
SRCS= ccexc.cc construct.cc virt.cc
LIB= testlib.so
OBJS= ${SRCS:.cc=.o}
CPICFLAGS= -fpic -DPIC
.cc.o:
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.if (${MACHINE_ARCH} == "i386")
all realall: ${LIB}
.else
all realall:
.endif
${LIB}: ${OBJS}
${CXX} -shared -o ${LIB} ${OBJS}
clean cleandir:
rm -f *.o *.so
regress:
.include <bsd.obj.mk>
.include <bsd.depall.mk>

View File

@ -0,0 +1,14 @@
// $NetBSD: ccexc.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $
// generate references to exception handling runtime code
extern "C" void ccexc(void);
void
ccexc(void)
{
try {
throw "mist";
} catch (char *e) {
}
}

View File

@ -0,0 +1,23 @@
// $NetBSD: construct.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $
// check constructor / destructor calls
#include <iostream>
class mist {
public:
mist(void);
~mist();
};
mist::mist(void)
{
cout << "constructor" << endl;
}
mist::~mist()
{
cout << "destructor" << endl;
}
static mist construct;

View File

@ -0,0 +1,15 @@
// $NetBSD: virt.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $
// g++ generates a reference to "__pure_virtual" with this code
class mist {
public:
virtual void vv(void) = 0;
};
class mast: public mist {
public:
void vv(void) {};
};
static mast virt;