diff options
author | Brad King <brad.king@kitware.com> | 2002-09-11 13:54:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-09-11 13:54:03 (GMT) |
commit | b9db890ebc8a5c900439c23cf7bdaa44721a35c3 (patch) | |
tree | d4f75ff12d69c59b976b7849257463f14d289337 /Source/cmDynamicLoader.h | |
parent | 994e30091436a22c035bc378c525ad90355a9d20 (diff) | |
download | CMake-b9db890ebc8a5c900439c23cf7bdaa44721a35c3.zip CMake-b9db890ebc8a5c900439c23cf7bdaa44721a35c3.tar.gz CMake-b9db890ebc8a5c900439c23cf7bdaa44721a35c3.tar.bz2 |
ENH: Pointer-to-function to pointer-to-data casts are not even allowed in strict C. Re-implemented this conversion in pure C++ using a casting trick with an extra level of indirection.
Diffstat (limited to 'Source/cmDynamicLoader.h')
-rw-r--r-- | Source/cmDynamicLoader.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index 7c49f90..3938528 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -37,16 +37,8 @@ typedef void* cmLibHandle; #endif -// C++ Does not allow casts from pointer-to-data types to -// pointer-to-function types. However, the return type from each -// platform's symbol lookup implementation is void*. We need to hide -// the cast from void* to a pointer-to-function type in C code. The -// implementation of cmDynamicLoader::GetSymbolAddress simply calls a -// C-based implementation in cmDynamicLoaderC.c. This -// cmDynamicLoaderFunction type is the return type of -// cmDynamicLoader::GetSymbolAddress and can be cast to any other -// pointer-to-function type safely in C++. -extern "C" { typedef void (*cmDynamicLoaderFunction)(); } +// Return type from cmDynamicLoader::GetSymbolAddress. +typedef void (*cmDynamicLoaderFunction)(); class cmDynamicLoader { |