Boost logo

Boost Users :

From: HartmutKaiser_at_[hidden]
Date: 2003-04-08 08:01:09


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 ?

AFAIK the C++ preprocessor does not support such operations directly. It
acts on preprocessor tokens and not on parts of them (which were needed
to convert every character to it's uppercase representation).

But what about using the Wave preprocessor for this task
(http://spirit.sourceforge.net/index.php?doc=docs/wave_v0_9/index.html)?
It's a matter of a day or so (if you're interested to try it), to add
some non-Standard feature to Wave, which helps to overcome your
problems.
This may be implemented as an additional operator _Pragma:

    _Pragma("wave tolower(WHATEVER)") and
    _Pragma("wave toupper(whatever)")

which then should expand to the expected result.

Your other problem (the addition of a leading underscore) is certainly
solvable with the help of the preprocessor.

Regards Hartmut


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