Ngspice: Preload a basically empty circuit to avoid error messages

Fixes https://gitlab.com/kicad/code/kicad/issues/12481

(cherry picked from commit 6e874f4c1e)
This commit is contained in:
Mikolaj Wielgus 2022-10-18 05:17:21 +02:00 committed by Seth Hillbrand
parent b004d7a1cb
commit ceaf3fc72d
1 changed files with 13 additions and 0 deletions

View File

@ -559,6 +559,19 @@ void NGSPICE::init_dll()
Command( "set noaskquit" ); Command( "set noaskquit" );
Command( "set nomoremode" ); 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; m_initialized = true;
} }