Hi, I've tried the instance like format.cpp and it seems to work. I'll add the required line to the code and use the test suite of mychem.
Thanks for your help, Jerome Le mercredi 9 juin 2010 11:02:16, Chris Morley a écrit : > In 2008 OBFormat was made part of the OBPlugin framework, which now > manages the map relating the formats IDs and the pointers to the > OBFormat objects. FormatFromMime() is a hangover from the old system, > with its map managed by OBFormat itself. It seems the latter is > working but the OBPlugin framework is not. > > Building OB on MinGW and CygWin gave similar problems with the formats > not being visible, which Tim solved by conditional code in each plugin > type's cpp file. See for instance line 26 of format.cpp . Maybe adding > to the conditional to get this code to run for your build would be a > solution. I'm afraid I don't understand how this fix works; maybe Tim > could comment whether this would be worth trying. > > Chris > > On 09/06/2010 07:00, Jérôme Pansanel wrote: > > Hi, > > > > This is an old thread, but the problem remains. I'm porting Mychem for > > MySQL 5.1, and it is not a piece of cake. MySQL has a new security > > 'feature' that requires to put the mychem library in the plugin > > directory > > (/usr/lib/mysql/plugin on Linux). When using this code, the > > SetInAndOutFormat function fails : > > ################################################################# > > > > ... > > > > OBConversion conv(&inStream,&outStream); > > OBFormat* inFormat = conv.FindFormat("smi"); > > OBFormat* outFormat = conv.FindFormat("mol"); > > > > if (conv.SetInAndOutFormats(inFormat, outFormat)) { > > > > // Set options > > > > ... > > > > ################################################################# > > > > > > Fredrik Wallner has found the following fix: > > ################################################################# > > > > ... > > > > OBConversion conv(&inStream,&outStream); > > OBFormat* inFormat = > > conv.FormatFromMIME("chemical/x-daylight-smiles"); OBFormat* > > outFormat = conv.FormatFromMIME("chemical/x-mdl-molfile"); > > > > if (conv.SetInAndOutFormats(inFormat, outFormat)) { > > > > // Set options > > > > ... > > > > ################################################################# > > > > > > But it can not work for every case (i.e. inchi has no mime type). Did you > > find a fix for loading all the symbols associated with the format > > plugins ? May be a linker option could help ? > > > > Cheers, > > > > Jerome Pansanel > > > > Le mardi 18 novembre 2008 16:55:18, Geoffrey Hutchison a écrit : > >>> Mychem has been updated in order to work with Open Babel 3. > >> > >> I think you mean Open Babel 2.2. The library "so" version is 3, but > >> the "external" version is 2.2. > >> > >>> - By default, the file formats are not recognized. For example, > >>> conv.SetInFormat("SMI") returns false. The library libopenbabel.so.3 > >>> must be > >>> loaded with dlopen to work correctly. > >> > >> ... > >> > >>> - The descriptors (TPSA, MR and logP) are not loaded. The fix is to > >>> initialize > >> > >>> each descriptor with: > >> For reasons I don't completely understand, the loader on Linux is a > >> bit strange (compared, say to Mac OS X or Windows). We've noticed > >> similar problems with scripting languages. > >> > >> If you write code which links to libopenbabel.so in C++, the library > >> itself runs dlopen. However, in other environments on Linux, the > >> *symbols* associated with these "plugins" are not actually available > >> > >> to anything. In Python, the fix is: > >> sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) > >> > >> Strangely, the library does this internally, but it doesn't seem to > >> > >> help: > >> return dlopen(lib_name.c_str(), RTLD_LAZY | RTLD_GLOBAL) != 0; > >> > >> Hope that helps, > >> -Geoff > >> > >> P.S. If there's someone reading who has a better knowledge of Linux > >> "ld" behavior, I'd be thrilled to know if there's a good solution for > >> the library. It seems like the Linux loader expects application > >> binaries to load libraries and plugins and NOT for libraries to load > >> plugins themselves. > > > > No virus found in this incoming message. > > Checked by AVG - www.avg.com > > Version: 9.0.829 / Virus Database: 271.1.1/2925 - Release Date: 06/08/10 > > 07:35:00 > > --------------------------------------------------------------------------- > --- 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-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss -- Jerome Pansanel IPHC 23, rue du Loess BP 28 F-67037 STRASBOURG CEDEX 2 Tel: +33 (0)3 88 10 66 24 Fax: +33 (0)3 88 10 62 34 ------------------------------------------------------------------------------ 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-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss