B
bcr07548
I am writing a C++ wrapper class for a library that was available in C
but am having some trouble because, at some point, one function was
replaced by a similar one. I would like to have it so my wrapper class
will work with either version of the library (I use both depending on
the system I am using) but there doesn't seem to be any #defines in the
library that will help me do this using an #ifdef test. Since #ifdef
directives only check for identifiers defined at the compiler level
with #define directives and not identifiers defined in the actual C/C++
code itself, I was wondering if there is any compiler level directive
to see if an identifier has been declared at the code level? What I
would like to be able to do is something like this:
#if_in_scope pthread_yield_np
pthread_yield_np();
#else
pthread_yield();
#endif
Does anyone have any ideas on how I could accomplish something like
this in a more or less standard way? If it helps, I am compiling with
GCC 4. If there isn't a standard way, does anyone know of a compiler
specific pragma that might get the job done?
-Brandon R
but am having some trouble because, at some point, one function was
replaced by a similar one. I would like to have it so my wrapper class
will work with either version of the library (I use both depending on
the system I am using) but there doesn't seem to be any #defines in the
library that will help me do this using an #ifdef test. Since #ifdef
directives only check for identifiers defined at the compiler level
with #define directives and not identifiers defined in the actual C/C++
code itself, I was wondering if there is any compiler level directive
to see if an identifier has been declared at the code level? What I
would like to be able to do is something like this:
#if_in_scope pthread_yield_np
pthread_yield_np();
#else
pthread_yield();
#endif
Does anyone have any ideas on how I could accomplish something like
this in a more or less standard way? If it helps, I am compiling with
GCC 4. If there isn't a standard way, does anyone know of a compiler
specific pragma that might get the job done?
-Brandon R