This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen in anonymous namespace

Tags: None
(comma "," separated)
bdejong
Registered Member
Posts
1
Karma
0

Eigen in anonymous namespace

Thu May 17, 2012 12:35 pm
Hello all,

we are building a library for ios, using Eigen... Ios libraries (as you may know) can only be static libraries. After searching a long time on the interwebs, we have come to the conclusion that the only way of hiding our symbols in our library is to put everything in anonymous namespaces, something we have been doing for our lib. So, basically our whole API now looks like:

Api.h ...
Api.cpp
Code: Select all
#include <...>
// lots of STD includes here

namespace {
all our code here
}

// implementation of API functions here


We've managed to shove everything into the anonymous namespace (including some rather fancy C++ libs), but we fail to add eigen to it. The problem is that we might get clashes if someone uses two libraries that both use Eigen. Our interface does not use eigen, so we would rather not expose Eigen's symbols...

Doing

Code: Select all
namespace {
#include "Eigen/Dense"
}


Gets us into a very messy situation with errors all over the place in both eigen ( std::max -> ::std::max ) and afterwards in our own code.

So the question is: is there a way to use Eigen like this?


- bram
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen in anonymous namespace

Sat May 19, 2012 8:40 pm
hm, I don't think there is any risk of name clash. So I'd not bother at trying to hide Eigen's symbols.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]