libmoost
/home/mhx/git/github/libmoost/src/pdl/symbol_function_cast.c
Go to the documentation of this file.
00001 /* vim:set ts=3 sw=3 sts=3 et: */
00028 /*
00029  * What a beautiful hack this is! This actually takes a void pointer
00030  * as returned by e.g. dlsym() on POSIX platforms and converts it to
00031  * a function pointer. This is perfectly legal in C, but forbidden in
00032  * C++, so we just solve this particular problem in C.
00033  *
00034  * It actually avoids an ever uglier hack involving a memcpy between
00035  * different pointer representations.
00036  */
00037 
00038 void *(*moost_pdl_symbol_to_function_cast_(void *p))()
00039 {
00040    return p;
00041 }