www.delorie.com/gnu/docs/libtool/libtool_51.html   search  
Buy GNU books!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.5.1 Error handling within user module loaders

Function: int lt_dladderror (const char *diagnostic)
This function allows you to integrate your own error messages into lt_dlerror. Pass in a suitable diagnostic message for return by lt_dlerror, and an error identifier for use with lt_dlseterror is returned.

If the allocation of an identifier fails, this function returns -1.

int myerror = lt_dladderror ("Doh!");
if (myerror < 0)
  perror (lt_dlerror ());

Function: int lt_dlseterror (int errorcode)
When writing your own module loaders, you should use this function to raise errors so that they are propogated through the lt_dlerror interface. All of the standard errors used by libltdl are declared in `ltdl.h', or you can add more of your own with lt_dladderror. This function returns 0 on success.

if (lt_dlseterror (LTDL_ERROR_NO_MEMORY) != 0)
  perror (lt_dlerror ());

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003