From 54320a8150c16a1e99e5338445c2df0f6ed3d0b9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 6 Jul 2009 17:38:44 +0000 Subject: [PATCH] Forward declare Metis stuff ourselves due to Metis header file stupidity. See the long comment at the top of this file for a detailed explanation. git-svn-id: https://svn.dealii.org/trunk@19024 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/source/sparsity_tools.cc | 40 +++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/deal.II/lac/source/sparsity_tools.cc b/deal.II/lac/source/sparsity_tools.cc index ccb4558d48..e26c14ef6a 100644 --- a/deal.II/lac/source/sparsity_tools.cc +++ b/deal.II/lac/source/sparsity_tools.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2008 by the deal.II authors +// Copyright (C) 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -19,8 +19,42 @@ #include #ifdef DEAL_II_USE_METIS -extern "C" { -# include +// This is sorta stupid. what we really would like to do here is this: +// extern "C" { +// # include +// } +// The problem with this is that (i) metis.h declares a couple of +// functions with different exception specifications than are +// declared in standard header files (in particular the drand48 +// function every one who's worked with Metis seems to know about); +// and (ii) metis.h may include which if we run a C++ +// compiler may include mpicxx.h -- but that leads to trouble +// because we have wrapped an +// extern "C" {...} +// around the whole block that now also includes a C++ header :-( +// +// The correct solution, of course, would be if Metis would produce +// a new dot release after 10 years that would remove the unnecessary +// function prototypes, and that would wrap the contents into +// #ifdef __C_PLUSPLUS__ +// extern "C" { +// #endif +// But that appears to not be happening, and so we have to do the +// following hack where we just forward declare everything ourselves :-( + +extern "C" +{ +// the following is from Metis-4.0/Lib/struct.h: + typedef int idxtype +// and this is from proto.h + void + METIS_PartGraphKway(int *, idxtype *, idxtype *, + idxtype *, idxtype *, int *, + int *, int *, int *, int *, idxtype *); + void + METIS_PartGraphRecursive(int *, idxtype *, idxtype *, + idxtype *, idxtype *, int *, + int *, int *, int *, int *, idxtype *); } #endif -- 2.39.5