Introduce __HIP_DISABLE_CPP_FUNCTIONS__ macro to disable C++ wrappers
hipMalloc and hipHostMalloc are C++ function templates by default. In some applications they need to discover the decltype of underlying C functions. In this commit, a new macro __HIP_DISABLE_CPP_FUNCTIONS__ is introduced to suppress the C++ function templates. Existing HIP applications don't need to be changed. hipMalloc and hipHostMalloc will behave just the same. For new applications which depends on identifying decltypes of underlying C functions, __HIP_DISABLE_CPP_FUNCTIONS__ shall be defined prior to including HIP headers.
이 커밋은 다음에 포함됨:
1 부모
16456b13f7
커밋
eba3bd3082
1 파일이 변경됨
+5
-1
@@ -318,9 +318,13 @@ enum hipComputeMode {
|
||||
*
|
||||
* Perform automatic type conversion to eliminate need for excessive typecasting (ie void**)
|
||||
*
|
||||
* __HIP_DISABLE_CPP_FUNCTIONS__ macro can be defined to suppress these
|
||||
* wrappers. It is useful for applications which need to obtain decltypes of
|
||||
* HIP runtime APIs.
|
||||
*
|
||||
* @see hipMalloc
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#if defined(__cplusplus) && !defined(__HIP_DISABLE_CPP_FUNCTIONS__)
|
||||
template <class T>
|
||||
static inline hipError_t hipMalloc(T** devPtr, size_t size) {
|
||||
return hipMalloc((void**)devPtr, size);
|
||||
|
||||
새 이슈에서 참조
사용자 차단