Gcc ignores character name wrapper when binding

The software that I work on ships with NETLIB BLAS / LAPACK embedded in its sources using the names of all lowercase characters, but now when I moved the application to the windows, I found that Intel MKL and several other BLAS / LAPACK implementations for this platform use all are variable character names. Is there any way to tell the gnu compiler / linker to ignore case when matching symbol names?

.
.
.
undefined reference to `_dgeqp3'
.
.
.

$ nm /lib/LAPACK.lib | grep -i " T _dgeqp3"
00000000 T _DGEQP3
+5
source share
3 answers

, , Fortran: Fortran, , , , Fortran : GNU , Intel Windows .

Fortran, -fsymbol-case-upper g77 ( gfortran ). C, :

  • #define 's
  • C BLAS LAPACK.
+2

, . 6.4.2.1 C , " " . , _DGEQP3 _DGEQP3 . , #define , .

, Windows, , , ?

+2

t.c

#define __CONCAT(x,y) x##y

#ifdef SUFFIX
#define __SUFFIX(x) __CONCAT(x,_)
#else
#define __SUFFIX(x) x
#endif

#ifdef UPPER
#define __c(U,l) __SUFFIX(U)
#else
#define __c(U,l) __SUFFIX(l)
#endif

#define xaxpy __c(XAXPY, xaxpy)

#include <stdio.h>

char* xaxpy;
char* DAXPY;

int main()
{
    printf(xaxpy);
    printf(DAXPY);
}

e.c

char* xaxpy  = "ln";
char* xaxpy_ = "ls";
char* XAXPY  = "UN";
char* XAXPY_ = "US";

, link-time --defsym:

Cetin@BAKA-CHAN ~
$ gcc -D UPPER -D SUFFIX -c t.c e.c

Cetin@BAKA-CHAN ~
$ gcc -o t t.o e.o -Wl,--defsym=_DAXPY=_xaxpy

Cetin@BAKA-CHAN ~
$ ./t
USln
Cetin@BAKA-CHAN ~
$

There should also be a way to give the linker different scripts to handle a large number of such symbol definitions. So I could make this part of the build process to automatically create linker scripts that create mappings between different cases.

+1
source

All Articles