Re: hiding xapian symbols

Subject: Re: hiding xapian symbols

Date: Tue, 21 Jun 2011 23:57:42 -0300

To: Daniel Kahn Gillmor, notmuch@notmuchmail.org

Cc:

From: David Bremner


On Tue, 21 Jun 2011 22:05:15 -0400, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
> However, i'm concerned that the act of hiding these symbols will make it
> so that any program that tries to link both libnotmuch and libxapian
> will be unable to use these symbols.
> 
> This makes me think that a program that links against libnotmuch and
> libxapian, but actually tries to *use* libxapian's exception handling
> may have a problem.
> 

This seems to work, when compiled "g++ foo.c -lnotmuch -lxapian"

I get 

,----
| Error opening database at /nonexistant/.notmuch: No such file or directory
| caught Cannot create directory `/nonexistant'
`----

don't run it as root ;)

#include <stdio.h>
#include <xapian.h>
#include <notmuch.h>
main (int argc, char **argv){

    notmuch_database_t *notmuch
      = notmuch_database_open ("/nonexistant",
				     NOTMUCH_DATABASE_MODE_READ_ONLY);

  try{
    (void)new Xapian::WritableDatabase ("/nonexistant",
					Xapian::DB_CREATE_OR_OPEN);
  } catch (const Xapian::Error &error) {
    printf("caught %s\n",error.get_msg().c_str());
  }
}

Thread: