2 * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: cadpli.c,v 1.7 2004/09/10 00:15:45 steve Exp $"
23 # include <vpi_user.h>
24 # include <veriuser.h>
31 # include "ivl_dlfcn.h"
33 typedef void* (*funcvp
)(void);
35 static void thunker_register(void)
37 struct t_vpi_vlog_info vlog_info
;
43 vpi_get_vlog_info(&vlog_info
);
45 for (idx
= 0 ; idx
< vlog_info
.argc
; idx
+= 1) {
46 char*module
, *cp
, *bp
;
47 if (strncmp("-cadpli=", vlog_info
.argv
[idx
], 8) != 0)
50 cp
= vlog_info
.argv
[idx
] + 8;
56 module
= malloc(bp
-cp
+1);
57 strncpy(module
, cp
, bp
-cp
);
60 mod
= ivl_dlopen(module
);
62 vpi_printf("%s link: %s\n", vlog_info
.argv
[idx
], dlerror());
68 boot
= ivl_dlsym(mod
, bp
);
70 vpi_printf("%s: Symbol %s not found.\n",
71 vlog_info
.argv
[idx
], bp
);
79 tf
= (*((funcvp
)boot
))();
82 veriusertfs_register_table(tf
);
86 void (*vlog_startup_routines
[])() = {
94 * Revision 1.7 2004/09/10 00:15:45 steve
97 * Revision 1.6 2004/09/05 21:19:51 steve
100 * Revision 1.5 2003/08/26 16:26:02 steve
101 * ifdef idents correctly.
103 * Revision 1.4 2003/04/30 01:28:06 steve
104 * Remove veriusertfs stuf.
106 * Revision 1.3 2003/02/22 04:04:38 steve
107 * Only include malloc.h if it is present.
109 * Revision 1.2 2003/02/17 00:01:25 steve
110 * Use a variant of ivl_dlfcn to do dynamic loading
111 * from within the cadpli module.
113 * Change the +cadpli flag to -cadpli, to keep the
114 * plusargs namespace clear.
116 * Revision 1.1 2003/02/16 02:23:54 steve
117 * Add the cadpli interface module.