int main() { unsigned int hdl1,hdl2; int ret = 0; hdl1 = register_dev("./device/mouse.so"); printf("%s\t%d\n",__func__,hdl1); getchar(); /* hdl2 = register_dev("./device/testDev1.so"); printf("%s\t%d\n",__func__,hdl2); getchar(); */ ret = unregister_dev(hdl1); printf("%s\t%d\n",__func__,ret); }
void netlist_t::start() { /* load the library ... */ /* make sure the solver and parameters are started first! */ for (auto & e : setup().m_device_factory) { if ( setup().factory().is_class<devices::NETLIB_NAME(mainclock)>(e.second) || setup().factory().is_class<devices::NETLIB_NAME(solver)>(e.second) || setup().factory().is_class<devices::NETLIB_NAME(gnd)>(e.second) || setup().factory().is_class<devices::NETLIB_NAME(netlistparams)>(e.second)) { auto dev = plib::owned_ptr<device_t>(e.second->Create(*this, e.first)); register_dev(std::move(dev)); } } log().debug("Searching for mainclock and solver ...\n"); m_mainclock = get_single_device<devices::NETLIB_NAME(mainclock)>("mainclock"); m_solver = get_single_device<devices::NETLIB_NAME(solver)>("solver"); m_gnd = get_single_device<devices::NETLIB_NAME(gnd)>("gnd"); m_params = get_single_device<devices::NETLIB_NAME(netlistparams)>("parameter"); /* create devices */ for (auto & e : setup().m_device_factory) { if ( !setup().factory().is_class<devices::NETLIB_NAME(mainclock)>(e.second) && !setup().factory().is_class<devices::NETLIB_NAME(solver)>(e.second) && !setup().factory().is_class<devices::NETLIB_NAME(gnd)>(e.second) && !setup().factory().is_class<devices::NETLIB_NAME(netlistparams)>(e.second)) { auto dev = plib::owned_ptr<device_t>(e.second->Create(*this, e.first)); register_dev(std::move(dev)); } } bool use_deactivate = (m_params->m_use_deactivate() ? true : false); for (auto &d : m_devices) { if (use_deactivate) { auto p = setup().m_param_values.find(d->name() + ".HINT_NO_DEACTIVATE"); if (p != setup().m_param_values.end()) { //FIXME: Error checking auto v = p->second.as_long(); d->set_hint_deactivate(!v); } } else d->set_hint_deactivate(false); } pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"})); m_lib = plib::palloc<plib::dynlib>(libpath); }