Standard behaviour of both ngspice and libngspice is:

- During start-up (initialization), read 'spinit'.

- Execute the commands found in 'spinit'

- Read .spiceinit.

- Execute the commands found in .spiceinit

- Read the netlist, excute it as prescribed with its dot commands and .control section commands.


File 'spinit' does contain commands for loading the code model shared libraries, including absolute path or relative path (relative to the current directory), for example 'codemodel ../lib/ngspice/xtradev.cm'.

With ngspice this sequence is indispensable.

With libngspice you may suppress reading spinit by the caller and load the code models individually, for example:

- Load libngspice

- Suppress reading spinit by executing ngSpice_nospinit()

- Initialize simulator by executing ngSpice_Init(...)

- Load code models (one after the other) by executing ngSpice_Command("codemodel ../lib/ngspice/spice2poly.cm" ) etc.


Code models and ngspice (or libngspice) have to be made and distributed together, no re-use of older code model versions.

Reply via email to