Update 2 to warning messages if osdi or code model files cannot be loaded

This commit is contained in:
Holger Vogt 2026-03-10 23:24:15 +01:00
parent 7d0dce0e70
commit 38ce7778b3
2 changed files with 19 additions and 3 deletions

View File

@ -1105,6 +1105,16 @@ struct card *inp_readall(FILE *fp, const char *dir_name, const char* file_name,
if (newcompat.ps && newcompat.a)
pspice_compat_a(working);
/* another warning that codemodels or osdi libs have not been loaded successfully */
if (ft_osdierror) {
fprintf(stderr, "Warning: OSDI libs have not been loaded successfully.\n");
fprintf(stderr, " Any of the following steps may fail, if Verilog A models are involved!.\n\n");
}
if (ft_codemodelerror) {
fprintf(stderr, "Warning: code models like analog.cm have not been loaded successfully.\n");
fprintf(stderr, " Any of the following steps may fail, if code models are involved!.\n\n");
}
struct nscope *root = inp_add_levels(working);
inp_probe(working);

View File

@ -58,6 +58,7 @@ static void free_dlerr_msg(char *msg);
#define RTLD_NOW 2 /* immediate function call binding */
#define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible to other
* dlopen'ed objs */
#define F_OK 0
#endif /* ifndef HAS_WINGUI */
#include "ngspice/dllitf.h" /* the coreInfo Structure*/
@ -405,9 +406,14 @@ int load_opus(const char *name)
lib = dlopen(name, RTLD_NOW);
// fprintf(stdout, "Lib %s has handle %p\n", name, lib);
if (!lib) {
msg = dlerror();
fprintf(stderr, "Error opening code model \"%s\"\n: %s\n", name, msg);
FREE_DLERR_MSG(msg);
int acc = access(name, F_OK);
if (acc != 0) {
fprintf(stderr, "Error opening code model \"%s\": No such file or directory!\n",
name);
}
else
fprintf(stderr, "Error opening code model \"%s\"\n", name);
return 1;
}