Mercurial > hg > octave-nkf
changeset 2061:098edb40c89b
[project @ 1996-04-07 21:56:15 by jwe]
author | jwe |
---|---|
date | Sun, 07 Apr 1996 22:02:43 +0000 |
parents | 7e430470e098 |
children | 055ffed429b8 |
files | configure.in dlfcn/dlfcn.c |
diffstat | 2 files changed, 39 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in +++ b/configure.in @@ -20,7 +20,7 @@ ### along with Octave; see the file COPYING. If not, write to the Free ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -AC_REVISION($Revision: 1.185 $) +AC_REVISION($Revision: 1.186 $) AC_PREREQ(2.9) AC_INIT(src/octave.cc) AC_CONFIG_HEADER(config.h) @@ -671,7 +671,7 @@ AC_CHECK_FUNCS(setvbuf getcwd gethostname bzero bcopy rindex vfprintf vsprintf) AC_CHECK_FUNCS(stricmp strnicmp strcasecmp strncasecmp strerror atexit) -AC_CHECK_FUNCS(on_exit tempnam memmove putenv) +AC_CHECK_FUNCS(on_exit tempnam memmove putenv strdup) AC_CHECK_FUNCS(mkdir rmdir rename umask) AC_CHECK_FUNCS(sigaction sigprocmask sigpending sigsuspend)
--- a/dlfcn/dlfcn.c +++ b/dlfcn/dlfcn.c @@ -4,6 +4,18 @@ * 30159 Hannover, Germany */ +/* + * Changes marked with `--jwe' were made on April 7 1996 by John W. Eaton + * <jwe@bevo.che.wisc.edu> to support g++ and/or use with Octave. + */ + +/* + * This makes my life easier with Octave. --jwe + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdio.h> #include <errno.h> #include <string.h> @@ -35,6 +47,8 @@ void (*term)(void); /* call static destructors */ } Cdtor, *CdtorPtr; +typedef void (*GccCDtorPtr)(void); + /* * The void * handle returned from dlopen is actually a ModulePtr. */ @@ -45,6 +59,8 @@ void *entry; /* entry point from load */ struct dl_info *info; /* optional init/terminate functions */ CdtorPtr cdtors; /* optional C++ constructors */ + GccCDtorPtr gcc_ctor; /* g++ constructors --jwe */ + GccCDtorPtr gcc_dtor; /* g++ destructors --jwe */ int nExports; /* the number of exports found */ ExportPtr exports; /* the array of exports */ } Module, *ModulePtr; @@ -62,7 +78,13 @@ static char errbuf[BUFSIZ]; static int errvalid; +/* + * The `fixed' gcc header files on AIX 3.2.5 provide a prototype for + * strdup(). --jwe + */ +#ifndef HAVE_STRDUP extern char *strdup(const char *); +#endif static void caterr(char *); static int readExports(ModulePtr); static void terminate(void); @@ -181,6 +203,15 @@ (*cp->init)(); cp++; } + /* + * If the shared object was compiled using g++, we will need + * to call global constructors using the _GLOBAL__DI function, + * and later, global destructors using the _GLOBAL_DD + * funciton. --jwe + */ + } else if (mp->gcc_ctor = (GccCDtorPtr)dlsym(mp, "_GLOBAL__DI")) { + (*mp->gcc_ctor)(); + mp->gcc_dtor = (GccCDtorPtr)dlsym(mp, "_GLOBAL__DD"); } else errvalid = 0; return mp; @@ -270,6 +301,12 @@ (*cp->term)(); cp++; } + /* + * If the function to handle global destructors for g++ + * exists, call it. --jwe + */ + } else if (mp->gcc_dtor) { + (*mp->gcc_dtor)(); } result = unload(mp->entry); if (result == -1) {