Browse Source

Display an error message if ngspice DLL is missing

pull/3/merge
Maciej Suminski 9 years ago
parent
commit
d869771f04
  1. 4
      eeschema/sim/ngspice.cpp
  2. 4
      eeschema/sim/sim_plot_frame.cpp
  3. 13
      eeschema/sim/spice_simulator.cpp

4
eeschema/sim/ngspice.cpp

@ -39,7 +39,9 @@ NGSPICE::NGSPICE()
#else
m_dll = new wxDynamicLibrary( "libngspice.so" );
#endif
assert( m_dll );
if( !m_dll || !m_dll->IsLoaded() )
throw std::runtime_error( "Missing ngspice shared library" );
// Obtain function pointers
m_ngSpice_Init = (ngSpice_Init) m_dll->GetSymbol( "ngSpice_Init" );

4
eeschema/sim/sim_plot_frame.cpp

@ -120,6 +120,10 @@ void SIM_PLOT_FRAME::StartSimulation()
/// @todo is it necessary to recreate simulator every time?
m_simulator.reset( SPICE_SIMULATOR::CreateInstance( "ngspice" ) );
if( !m_simulator )
return;
m_simulator->SetReporter( new SIM_THREAD_REPORTER( this ) );
m_simulator->Init();
m_simulator->LoadNetlist( formatter.GetString() );

13
eeschema/sim/spice_simulator.cpp

@ -24,8 +24,19 @@
#include "ngspice.h"
#include <confirm.h>
SPICE_SIMULATOR* SPICE_SIMULATOR::CreateInstance( const std::string& )
{
return new NGSPICE;
try
{
return new NGSPICE;
}
catch( std::exception& e )
{
DisplayError( NULL, e.what() );
}
return NULL;
}
Loading…
Cancel
Save