Add .dylib file extension and improve some messages in d_cosim.
On Macos, the command "ghdl -e -shared ..." creates .dylib files.
This commit is contained in:
parent
e858ca9465
commit
da8e237e11
|
|
@ -94,14 +94,21 @@ static void callback(ARGS, Mif_Callback_Reason_t reason)
|
||||||
if (reason == MIF_CB_DESTROY) {
|
if (reason == MIF_CB_DESTROY) {
|
||||||
if (!ip)
|
if (!ip)
|
||||||
return;
|
return;
|
||||||
if (ip->info.cleanup)
|
if (ip->info.cleanup) {
|
||||||
|
DBG("Calling cleanup.");
|
||||||
(*ip->info.cleanup)(&ip->info);
|
(*ip->info.cleanup)(&ip->info);
|
||||||
|
}
|
||||||
if (ip->info.lib_argv)
|
if (ip->info.lib_argv)
|
||||||
free((void *)ip->info.lib_argv);
|
free((void *)ip->info.lib_argv);
|
||||||
if (ip->info.sim_argv)
|
if (ip->info.sim_argv)
|
||||||
free((void *)ip->info.sim_argv);
|
free((void *)ip->info.sim_argv);
|
||||||
if (ip->so_handle)
|
if (ip->so_handle) {
|
||||||
dlclose(ip->so_handle);
|
DBG("Unloading co-simulation.");
|
||||||
|
if (dlclose(ip->so_handle)) {
|
||||||
|
cm_message_printf("Error unloading co-simulation: %s",
|
||||||
|
dlerror());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ip->q)
|
if (ip->q)
|
||||||
free(ip->q);
|
free(ip->q);
|
||||||
if (ip->out_vals)
|
if (ip->out_vals)
|
||||||
|
|
@ -131,6 +138,13 @@ static const char *exts[] = { "", ".so", ".DLL", NULL};
|
||||||
#define NGSPICELIBDIR "C:\\Spice64\\lib\\ngspice" // Defined by configure?
|
#define NGSPICELIBDIR "C:\\Spice64\\lib\\ngspice" // Defined by configure?
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
|
||||||
|
static const char *exts[] = { "", ".so", ".dylib", NULL};
|
||||||
|
#define CMPFN strcmp
|
||||||
|
#define TESTFN(f) (access(f, R_OK) == 0)
|
||||||
|
#define SLIBFILE "dynamic library"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static const char *exts[] = { "", ".so", NULL};
|
static const char *exts[] = { "", ".so", NULL};
|
||||||
|
|
@ -138,6 +152,7 @@ static const char *exts[] = { "", ".so", NULL};
|
||||||
#define TESTFN(f) (access(f, R_OK) == 0)
|
#define TESTFN(f) (access(f, R_OK) == 0)
|
||||||
#define SLIBFILE "shared library"
|
#define SLIBFILE "shared library"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FLAGS (RTLD_GLOBAL | RTLD_NOW)
|
#define FLAGS (RTLD_GLOBAL | RTLD_NOW)
|
||||||
|
|
||||||
static void *cosim_dlopen(const char *fn)
|
static void *cosim_dlopen(const char *fn)
|
||||||
|
|
@ -422,6 +437,8 @@ static bool check_input(struct instance *ip, Digital_t *ovp,
|
||||||
while (ip->q_index >= 0 && ip->q[ip->q_index].when >= rp->when)
|
while (ip->q_index >= 0 && ip->q[ip->q_index].when >= rp->when)
|
||||||
--ip->q_index;
|
--ip->q_index;
|
||||||
if (ip->q_index >= 0) {
|
if (ip->q_index >= 0) {
|
||||||
|
DBG("Input Q full: d_cosim setting back to %.15g.",
|
||||||
|
(rp->when + ip->q[ip->q_index].when) / 2);
|
||||||
cm_analog_set_temp_bkpt(
|
cm_analog_set_temp_bkpt(
|
||||||
(rp->when + ip->q[ip->q_index].when) / 2);
|
(rp->when + ip->q[ip->q_index].when) / 2);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -473,7 +490,8 @@ void ucm_d_cosim(ARGS)
|
||||||
fn = PARAM(simulation);
|
fn = PARAM(simulation);
|
||||||
handle = cosim_dlopen(fn);
|
handle = cosim_dlopen(fn);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
cm_message_send("d_cosim failed to load simulation binary.");
|
cm_message_printf("d_cosim failed to load simulation binary %s.",
|
||||||
|
fn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ifp = (void (*)(struct co_info *))dlsym(handle, "Cosim_setup");
|
ifp = (void (*)(struct co_info *))dlsym(handle, "Cosim_setup");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue