On 04/06/2010 05:26, 채종학 wrote: > I am developing a modeling program using OpenBabel on MicroSoft Windows, > VisualStudio 2010/2008. > The openbabel version is 2.2.3 or the last development branch, and are > converted into SINGLE_DLL. > > All functions good, such as reading molecule files, converting to smiles > coordinates, plugins, etc. > I can retrieve all the plugin lists : > OBPlugin::ListAsVector( "Formats" ); > gives a list of all 98 molecule file formats; > OBPlugin::ListAsVector( "Ops" ); > gives a list of all 9 availabel operations, fillUC, gen2D, gen3D, > genalias, etc... > > The problem is that the plugins does not function as expected. > > With > OBOp* pOp = OBOp::FindType("Gen3D"); , > the pOp becomes NULL; > > All other plugins (gen2D, gen3D, genalias, MMFF94, etc...) works the same. > > With STATIC_LIBRARY version (not in SINGLE_DLL), I was able to use all > the plugin functions. > > Can anybody help me?
You need to make at least one instance of OBConversion, so that the plugin files are loaded. (I realise that this is not very elegant and we should find a better way.) So with Visual Studio 2008, the trunk code and the CMake default build (making openbabel2.dll and several plugin .obf files) and the short exe below: without an OBConversion object, only genalias is listed (it is the only Op in openababel2.dll) and pOp is NULL; with the line uncommented, all the ops are listed and pOp is not NULL. Is there a reason for you to include the format files in a single DLL? Would it not be easier to use the standard build? Chris #include <openbabel/op.h> #include <openbabel/obconversion.h> using namespace OpenBabel; int main(int argc,char **argv) { // OBConversion dummy; OBPlugin::List( "Ops" ); OBOp* pOp = OBOp::FindType("gen3D"); std::cout << "gen3D is at " << pOp; return 0; } ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel