possible HP/UX portability support.
This commit is contained in:
parent
02fc59fbdf
commit
b712c3f5ca
|
|
@ -0,0 +1,67 @@
|
|||
#ifndef __ivl_dlfcn_H
|
||||
#define __ivl_dlfcn_H
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: ivl_dlfcn.h,v 1.1 2001/01/14 17:12:59 steve Exp $"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DLFCN_H)
|
||||
# include <dlfcn.h>
|
||||
typedef void* ivl_dll_t;
|
||||
#elif defined(HAVE_DL_H)
|
||||
# include <dl.h>
|
||||
typedef shl_t ivl_dll_t;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DLFCN_H)
|
||||
inline ivl_dll_t ivl_dlopen(const char*name)
|
||||
{ return dlopen(name,RTLD_NOW); }
|
||||
|
||||
inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
|
||||
{ return dlsym(dll, nm); }
|
||||
|
||||
inline void ivl_dlclose(ivl_dll_t dll)
|
||||
{ dlclose(dll); }
|
||||
|
||||
#elif defined(HAVE_DL_H)
|
||||
inline ivl_dll_t ivl_dlopen(const char*name)
|
||||
{ return shl_load(name, BIND_IMMEDIATE, 0); }
|
||||
|
||||
inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
|
||||
{
|
||||
void*sym;
|
||||
int rc = shl_findsym(&dll, nm, TYPE_PROCEDURE, &sym);
|
||||
return (rc == 0) ? sym : 0;
|
||||
}
|
||||
|
||||
inline void ivl_dlclose(ivl_dll_t dll)
|
||||
{ shl_unload(dll); }
|
||||
|
||||
inline const char*dlerror(void)
|
||||
{ return strerror( errno ); }
|
||||
#endif
|
||||
|
||||
/*
|
||||
* $Log: ivl_dlfcn.h,v $
|
||||
* Revision 1.1 2001/01/14 17:12:59 steve
|
||||
* possible HP/UX portability support.
|
||||
*
|
||||
*/
|
||||
#endif
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: vvm_calltf.cc,v 1.11 2000/02/23 02:56:56 steve Exp $"
|
||||
#ident "$Id: vvm_calltf.cc,v 1.12 2001/01/14 17:12:59 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "machine.h"
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
# include <stdarg.h>
|
||||
# include <malloc.h>
|
||||
# include <stdio.h>
|
||||
# include <dlfcn.h>
|
||||
# include "ivl_dlfcn.h"
|
||||
|
||||
# define MAX_PATHLEN 1024
|
||||
|
||||
|
|
@ -63,12 +63,12 @@ typedef void (*vlog_startup_routines_t)(void);
|
|||
|
||||
void vvm_load_vpi_module(const char*name)
|
||||
{
|
||||
void*mod = 0;
|
||||
ivl_dll_t mod = 0;
|
||||
const char*path = getenv("VPI_MODULE_PATH");
|
||||
if (path == 0) path = module_path;
|
||||
|
||||
if ((path == 0) || (strchr(name, '/'))) {
|
||||
mod = dlopen(name, RTLD_NOW);
|
||||
mod = ivl_dlopen(name);
|
||||
if (mod == 0) {
|
||||
cerr << name << ": " << dlerror() << endl;
|
||||
return;
|
||||
|
|
@ -90,7 +90,7 @@ void vvm_load_vpi_module(const char*name)
|
|||
dest[n+1] = 0;
|
||||
strcat(dest, name);
|
||||
|
||||
mod = dlopen(dest, RTLD_NOW);
|
||||
mod = ivl_dlopen(dest);
|
||||
if (mod) break;
|
||||
}
|
||||
}
|
||||
|
|
@ -100,12 +100,12 @@ void vvm_load_vpi_module(const char*name)
|
|||
return;
|
||||
}
|
||||
|
||||
void*table = dlsym(mod, LU "vlog_startup_routines" TU);
|
||||
void*table = ivl_dlsym(mod, LU "vlog_startup_routines" TU);
|
||||
vlog_startup_routines_t*routines = (vlog_startup_routines_t*)table;
|
||||
if (routines == 0) {
|
||||
cerr << name << ": Unable to locate the vlog_startup_routines"
|
||||
" table." << endl;
|
||||
dlclose(mod);
|
||||
ivl_dlclose(mod);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +117,9 @@ void vvm_load_vpi_module(const char*name)
|
|||
|
||||
/*
|
||||
* $Log: vvm_calltf.cc,v $
|
||||
* Revision 1.12 2001/01/14 17:12:59 steve
|
||||
* possible HP/UX portability support.
|
||||
*
|
||||
* Revision 1.11 2000/02/23 02:56:56 steve
|
||||
* Macintosh compilers do not support ident.
|
||||
*
|
||||
|
|
@ -131,28 +134,5 @@ void vvm_load_vpi_module(const char*name)
|
|||
* persistent, rewrite the simulation scheduler
|
||||
* in C (to interface with VPI) and add VPI support
|
||||
* for callbacks.
|
||||
*
|
||||
* Revision 1.7 1999/10/10 14:57:38 steve
|
||||
* Handle display of odd octal/hex widths (Eric Ardoom)
|
||||
*
|
||||
* Revision 1.6 1999/09/29 01:41:18 steve
|
||||
* Support the $write system task, and have the
|
||||
* vpi_scan function free iterators as needed.
|
||||
*
|
||||
* Revision 1.5 1999/09/13 03:08:10 steve
|
||||
* fix vpiHexStrVal dumping of digits to strings.
|
||||
*
|
||||
* Revision 1.4 1999/08/19 02:51:11 steve
|
||||
* Add vpi_sim_control
|
||||
*
|
||||
* Revision 1.3 1999/08/15 01:23:56 steve
|
||||
* Convert vvm to implement system tasks with vpi.
|
||||
*
|
||||
* Revision 1.2 1999/05/31 15:46:36 steve
|
||||
* Handle time in more places.
|
||||
*
|
||||
* Revision 1.1 1998/11/09 23:44:10 steve
|
||||
* Add vvm library.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue