atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
231 stars 31 forks source link

Error: Not valid D: cuda_runtime_api.h failed in dpp-0.4.10 (dpp-0.4.4 was ok) #312

Closed mw66 closed 2 years ago

mw66 commented 2 years ago
$ cat ./cuda_runtime_api.dpp
#include <cuda_runtime_api.h>

$ ~/.dub/packages/dpp-0.4.4/dpp/bin/d++ --preprocess-only --hard-fail --include-path=/usr/include --keep-d-files --compiler=ldmd2  ./cuda_runtime_api.dpp
$ echo $?
0

$ ~/.dub/packages/dpp-0.4.10/dpp/bin/d++ --preprocess-only --hard-fail --include-path=/usr/include --keep-d-files --compiler=ldmd2  ./cuda_runtime_api.dpp
Untranslatable cursor Cursor(FunctionDecl, "cudaGetSymbolAddress", Type(FunctionProto, "cudaError_t (void **, const void *)"), Type(Typedef, "cudaError_t"))
Error: Not valid D:
------------
/**
 * \brief Finds the address associated with a CUDA symbol
 *
 * Returns in \p *devPtr the address of symbol \p symbol on the device.
 * \p symbol is a variable that resides in global or constant memory space.
 * If \p symbol cannot be found, or if \p symbol is not declared in the
 * global or constant memory space, \p *devPtr is unchanged and the error
 * ::cudaErrorInvalidSymbol is returned.
 *
 * \param devPtr - Return device pointer associated with symbol
 * \param symbol - Device symbol address
 *
 * \return
 * ::cudaSuccess,
 * ::cudaErrorInvalidSymbol,
 * ::cudaErrorNoKernelImageForDevice
 * \notefnerr
 * \note_string_api_deprecation
 * \note_init_rt
 * \note_callback
 *
 * \sa
 * \ref ::cudaGetSymbolAddress(void**, const T&) "cudaGetSymbolAddress (C++ API)",
 * \ref ::cudaGetSymbolSize(size_t*, const void*) "cudaGetSymbolSize (C API)",
 * ::cuModuleGetGlobal
 */
__dpp_aggregate__ cudaError cudaGetSymbolAddress(void**, const(void)*) @nogc nothrow;
------------

$ echo $?
1

$ dpkg -S /usr/include/cuda_runtime_api.h
nvidia-cuda-dev:amd64: /usr/include/cuda_runtime_api.h

$ wc /usr/include/cuda_runtime_api.h
 12077  67841 509599 /usr/include/cuda_runtime_api.h

$ dpkg -l nvidia-cuda-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version         Architecture Description
+++-=====================-===============-============-=================================
ii  nvidia-cuda-dev:amd64 11.2.2-1ubuntu1 amd64        NVIDIA CUDA development files