Ngspice: Preload a basically empty circuit to avoid error messages

Fixes https://gitlab.com/kicad/code/kicad/issues/12481
This commit is contained in:
Mikolaj Wielgus 2022-10-18 05:17:21 +02:00
parent 9eb3854794
commit 6e874f4c1e
1 changed files with 13 additions and 0 deletions

View File

@ -579,6 +579,19 @@ void NGSPICE::init_dll()
Command( "set noaskquit" );
Command( "set nomoremode" );
// reset and remcirc give an error if no circuit is loaded, so load an empty circuit at the
// start.
vector<char*> lines;
lines.push_back( strdup( "*" ) );
lines.push_back( strdup( ".end" ) );
lines.push_back( nullptr ); // Sentinel.
m_ngSpice_Circ( lines.data() );
for( auto line : lines )
free( line );
m_initialized = true;
}