[ghemical-devel] Linking libghemical to other software

Tommi Hassinen thassine at messi.uku.fi
Mon Jul 17 07:41:26 EDT 2006


On Mon, 17 Jul 2006, Rob Schellhorn wrote:

> I've made my dll using:
> gcc	-mno-cygwin

Yes, you definitely need this flag.

> Now I want to use the dll OUTSIDE a Cygwin environment. The problem is that
> the dll crashes when trying to access the parameter files under
> /usr/local/share/libghemical, because this path does not exists in Windows
> of course.
>
> So my question:
> Is it possible to adapt the source of libghemical so it is no longer
> dependant
> of those parameter files? (e.g. embed them in source...)

Embedding in source will be hard in the long run, since the files will 
change sometimes, and some new might appear.

> If this is not possible, can I change the search path for the parameter
> files
> relative to the started application.

Please see this (at model.cpp around line 223) :

void model::OpenLibDataFile(ifstream & file, bool is_binary_file, const char * fn)
{
 	ostringstream oss;
 	oss << model::libdata_path << DIR_SEPARATOR << model::libversion << DIR_SEPARATOR << fn << ends;

//	cout << "DEBUG ; preparing to open file " << oss.str() << endl;

 	if (!is_binary_file) file.open(oss.str().c_str(), ios::in);
 	else file.open(oss.str().c_str(), ios::in | ios::binary);

 	if (file.good()) return;

 	file.close();

 	cerr << "Error : could not open file " << oss.str().c_str() << endl;
 	exit(EXIT_FAILURE);
}

The data files are all opened using this same routine. Perhaps you can 
make your own modifications using

#ifdef BIOCLIPSE_PLUIGIN
//your version for windows
#else
//the common unix version
#endif

> Note that the 'official' Windows port seems to be broken... when started
> it goes to 100% cpu and stays there. It is possible however that this
> problem
> is Visual Studio 2005 related.

Humm... Perhaps the program hangs and locks since it can't find the data 
files it looks for ; that would definitely make it lock. Perhaps you could 
uncomment the debug message above (or make it appear as a messagebox in 
windows).

Regards,

 	Tommi



More information about the ghemical-devel mailing list