Boost logo

Boost Users :

From: Paul Mensonides (yg-boost-users_at_[hidden])
Date: 2003-04-08 14:42:58


Toon Knapen wrote:
> In the ublas forum we're having a discussion on the best way to
> provide signatures in C for fortran libraries (like BLAS and LAPACK).
> For linking C with fortran, you sometimes need to add an underscore
> to the function in C, but on other platforms fortran will store
> the function-name in capitals.
>
> Thus on different platforms, we should preprocess our source to take
> the platforms' convention into account and we thus would need a macro
> to convert an identifier automatically to uppercase. Is that possible
> ?

It is not _generally_ possible to pull apart the an arbitrary identifier.
However, if the identifier is _already_ pulled apart, it is possible. E.g.
dealing with "identifier" is not possible in a general fashion; dealing with "i
d e n t i f i e r" is possible, and the identifier itself could be abstracted to
something like:

FORTRAN_ID( identifier )

For example, if you have these identifiers:

abc, xyz, pqr

#define FORTRAN_ID_abc a b c
#define FORTRAN_ID_xyz x y z
#define FORTRAN_ID_pqr p q r

You can get:

FORTRAN_ID( abc ) >> abc, _abc, or ABC
FORTRAN_ID( xyz ) >> xyz, _xyz, or XYZ
FORTRAN_ID( pqr ) >> pqr, _pqr, or PQR

If that sounds okay, I can implement it for you.

Regards,
Paul Mensonides


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net