adms3, use -ldl instead of -lltdl, fix include path

This commit is contained in:
rlar 2011-12-17 13:45:39 +00:00
parent 0e1f5a29f7
commit af03c472af
3 changed files with 26 additions and 18 deletions

View File

@ -1,3 +1,8 @@
2011-12-17 Robert Larice
* src/spicelib/devices/dev.c ,
* src/spicelib/devices/adms/admst/ngspice.xml :
adms3, use -ldl instead of -lltdl, fix include path
2011-12-17 Robert Larice
* src/frontend/breakp2.c ,
* src/frontend/outitf.c ,

View File

@ -3371,9 +3371,9 @@ get_$(module)_info(void)
#ifndef $(module)
#define $(module)
#include "src/include/ngspice/ngspice.h"
#include "src/include/ngspice/devdefs.h"
#include "src/include/ngspice/sperror.h"
#include "ngspice/ngspice.h"
#include "ngspice/devdefs.h"
#include "ngspice/sperror.h"
#ifndef DEV_$(module)
#define DEV_$(module)

View File

@ -168,7 +168,7 @@ int DEVflag(int type){
#if ADMS >= 3
#include "ngspice/fteext.h" /* for ft_sim */
#include "ngspice/cktdefs.h" /* for DEVmaxnum */
#include <ltdl.h>
#include <dlfcn.h>
static void varelink(CKTcircuit *ckt) {
/*
@ -189,41 +189,44 @@ static void varelink(CKTcircuit *ckt) {
}
int load_vadev(CKTcircuit *ckt, char *name)
{
char libname[50];
char *msg, libname[50];
void *lib;
SPICEadmsdev *device;
int l=(int)strlen("lib")+(int)strlen(name)+(int)strlen(".so");
void* fetch; /* fixme funptr_t */
strcpy(libname, "lib");
strcat(libname,name);
strcat(libname,".so");
libname[l+1]='\0';
lt_dlinit ();
lt_dlsetsearchpath (".");
lib = lt_dlopen(libname);
lib = dlopen(libname, RTLD_NOW);
if(!lib){
perror (lt_dlerror ());
msg = dlerror();
printf("%s\n", msg);
return -1;
}
strcpy(libname, "get_");
strcat(libname,name);
strcat(libname,"_info");
device = ((SPICEadmsdev * (*)(void)) lt_dlsym(lib,libname)) ();
fetch = dlsym(lib,libname);
if(!device){
perror (lt_dlerror ());
if(fetch)
device = ((SPICEadmsdev * (*)(void)) fetch) ();
else
device = NULL;
if(!device) {
msg = dlerror();
printf("%s\n", msg);
return -1;
}
device->mkn = ((int (*)(GENmodel *, CKTcircuit *)) &CKTmkVolt);
device->mkj = ((int (*)(CKTcircuit *, GENmodel *, IFuid)) &SMPmakeElt);
DEVices = TREALLOC(SPICEdev *, DEVices, DEVNUM + 1);
printf("Added device: %s from dynamic library %s\n",((SPICEdev *)device)->DEVpublic.name,lib);
printf("Added device: %s from dynamic library %s\n", ((SPICEdev *)device)->DEVpublic.name, libname);
DEVices[DEVNUM++] = (SPICEdev *)device;
varelink(ckt);
return DEVNUM-1;