It looks like you're new here. If you want to get involved, click one of these buttons!
I'm not sure why the following does not work - I hope it's something simple.
Here is a condensed excerpt of code:
db::Manager KLAYOUT_MANAGER;
db::Layout *fbLayout = new db::Layout(&KLAYOUT_MANAGER);
fbLayout->dbu(0.001);
db::cell_index_type chipCellIndex, arrayCellIndex;
chipCellIndex = fbLayout->add_cell("chip");
arrayCellIndex = fbLayout->add_cell("array");
db::Cell &chipCell = fbLayout->cell(chipCellIndex);
db::Cell &arrayCell = fbLayout->cell(arrayCellIndex);
db::Point pt(-2045, -3000);
// 0 => R0, I don't know how to properly use reference R0
db::Trans trans_matrix(0, pt);
db::Point a(2045, 0);
db::Point b(0, 3000);
db::CellInstArray array(chipCellIndex, trans_matrix, a, b, 2, 2);
arrayCell.insert(array); // !!! Code dies here !!!
The code dies saying:
klayout: symbol lookup error: /local/davei/svn/CF/tools/framebuilder_5/trunk/bin/fbapi.so: undefined symbol: _ZN2db9Instances6insertIPNS_5arrayINS_8CellInstENS_12simple_transIiEEEEEENS_8InstanceERKT_
Note that 'fbapi.so' is my own .so file containing the code above that builds an array.
However ddd says: no symbol "m_instances" in current context. The context is below:
========= dbCell.h =========
template <class Inst>
Instance insert (const Inst &inst)
{
return m_instances.insert (inst); // ddd: no symbol "m_instances" in current context.
}
Any Ideas?
Thanks,
Dave Inman
Comments
Hi Dave,
I don't know exactly what you do, but that looks like a clash of symbols - maybe the fpapi.so has hijacked a symbol from the application so it gets called rather the application code.
I assume you included a header and this caused template instantiation. This will create some symbols which interfere with the application. But what happens then strongly depends on how you load the library.
Matthias
Matthias,
OK, I'll check that possibility. Thanks so much for having a look.
My application starts KLayout and invokes a ruby script. That script loads
the fbapi.so. Functions in the fbapi.so are swig-created wrappers of my own
code and they, in turn, can call KLayout routines. I know this is perhaps a
bit more than others may be doing in its strategy. So far, prototypes of this
way of accessing KLayout methods have worked, but I did run into this problem.
My code includes
dbLayout.h
layApplication.h
As you can see I am using fully qualified namespace references rather than
'using namespace db' for instance.
Dave
Hi Dave,
in order to make this work, you'll need to link everything of KLayout to your library so it does not require external symbols. In your case this will be dbInstances.o which will itself require other symbols and so forth.
KLayout is NOT modularized in a way it's easy to take out parts. So I guess in the end you will need to link half of the code to your library.
Plus, please note the implications of GPL license: if you do this you are basically required to put your project under GPL as well. Importing your code into KLayout is something else.
Matthias
Thanks for the explanations. They help a lot. For now, it will be simpler if
I don't use the approach above.