Display an error message if ngspice DLL is missing
This commit is contained in:
parent
132e30081b
commit
d869771f04
|
@ -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" );
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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…
Reference in New Issue