This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GSL and Borland C++ Builder


I wanted to use the Gnu Scientific Library (GSL) with Borland C++ Builder (BCB) version 6. Since I have not found any ports for this compiler, I tried the port for MSVC that can be found atwww.network-theory.co.uk, used the implib utility supplied with BCB to import the DLL libraries and added #include <gsl/interp.h> to my source to use the interpolation routines.

There was a REALLY strange problem causing general protection fault in gsl_spline_alloc. After some time I found that it is caused by the GSL_VAR macro from gsl_types.h For use with BCB it must take this form

#ifndef GSL_VAR

#if defined(__BORLANDC__) || defined(__BCPLUSPLUS__)
/* We have a Borland compiler
It has __WIN32__ instead of WIN32 in MSVC,
__DLL__ instead of _DLL in MSVC
also add extern to the macro
*/
# ifdef __WIN32__
# ifdef __DLL__
# define GSL_VAR extern __declspec(dllexport)
# else
# define GSL_VAR extern __declspec(dllimport)
# endif
# else
# define GSL_VAR extern
# endif
#else
# ifdef WIN32 /* Non-Borland compiler */
# ifdef _DLL
# ifdef DLL_EXPORT
# define GSL_VAR __declspec(dllexport)
# else
# define GSL_VAR __declspec(dllimport)
# endif
# else
# define GSL_VAR extern
# endif
# else
# define GSL_VAR extern
# endif
#endif

#endif /* GSL_VAR */

The original version did not contain the lines between
#if defined(__BORLANDC__) || defined(__BCPLUSPLUS__)
and
#else

There might be some other problems in using BCB with GSL, but changing this avoided invalid pointers passed to gsl_spline_alloc.

The same applies to the free Borland C++ Compiler, which is the core of BCB.

--
Bolek



Checked by RAV antivirus for postfix on mail.ure.cas.cz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]