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 again


Hi,

there was an error in my previous post on how to use GSL with Borland C++ Builder. I wrote you need the GSL DLL library compiled with Microsoft Visual C++ you can simply find at www.network-theory.co.uk, use the implib utility supplied with BCB to make an import library for that DLL and you need to redefine the GSL_VAR macro to

> #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 */
>

Well, this new definition is wrong (at least) in the case you want to call GSL.DLL functions from another DLL you wrote yourselves. It is because the __DLL__ macro will be defined in such a situation and GSL_VAR will evaluate to
> # define GSL_VAR extern __declspec(dllexport)
which is wrong.


The correct redefinition is:
use
#define GSL_VAR extern __declspec(dllimport)
every time, regardless __DLL__ being defined. Use
#define GSL_VAR extern __declspec(dllexport)
if and only if you try to make GSL.DLL from the GSL sources.




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]