No. This is a preprocessor directive. Technically, such "constant" it does not exist in the compiled executable code. It is not a constant, this is a non-compiled text inserted in the source code in the places where it is used, before compilation. After compilation, it is compiled to
immediate constants dispersed in different placed of the code or anything else, which is defined by the details and options of compilation, optimization, etc. You don't have a full control over it and no access from the loaded executable image like DLL.
You can create a static C++ function returning the value you need, export and then P/Invoke that function. For example:
http://stackoverflow.com/questions/3146017/how-do-i-share-a-constant-between-c-sharp-and-c-code[
^].
Besides, I would recommend you to avoid using C++ "
#define
" for the purpose of the definition of values. This practice is majorly obsolete, means poor coding style.
—SA