[Trilinos-Users] Teuchos LAPACK wrapper and ISO C++

Thornquist, Heidi K hkthorn at sandia.gov
Wed Mar 19 10:01:17 MDT 2008

Hi Dan,

The TREVC wrapper is wrong, the SELECT argument should be a logical array (int *) and instead is being passed a function pointer as if it was a logical external function for sorting.  If you replace "int (*ptr2func)(double*,double*)" with "int *" in the Teuchos_LAPACK_wrappers.hpp and Teuchos_LAPACK.hpp files this wrapper should work for you.  I will file a bug report against the wrapper and have it fixed by the next Trilinos 8.0 tarball release.


On 3/18/08 8:14 AM, "Dan Erik Petersen" <danerik at diku.dk> wrote:

Hi everyone,

We're having a bit of trouble with the Teuchos LAPACK wrappers.

We're looking to call the LAPACK function

void Teuchos::LAPACK< OrdinalType, ScalarType >::TREVC( ... )

where OrdinalType = int and ScalarType = double

the problem arises with the third argument to TREVC : OrdinalType(*)
(ScalarType *, ScalarType *) ptr2func
which we supply with "(int (*)(double*,double*))select"

where select has been initialized to be a vector of integers : int *

Thus we cast this pointer to an object (int * select) to a pointer to
a function (int(*)(double*,double*)). The problem is that this is not
allowed by ISO C++ (we're compiling with -Werror -pedantic), and this
throws an warning/error. Is there a way around this or an example
anyone could provide such that we can continue using strict warnings
on our compiled code?

The warning thrown by compilation is:
warning: ISO C++ forbids casting between pointer-to-function and



Dan Erik Petersen, Ph.D. Student
Department of Computer Science, University of Copenhagen (DIKU)
Universitetsparken 1, 2100 Copenhagen, Denmark
Phone: +45 35 32 14 00, Fax: +45 35 32 14 01
E-mail: danerik at diku.dk  Home page: www.diku.dk/~danerik

Trilinos-Users mailing list
Trilinos-Users at software.sandia.gov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20080319/fe7b413f/attachment.html

More information about the Trilinos-Users mailing list