0
#if _WIN32
        const string DLL_NAME = "uFCoder-x86.dll"; // for x86 target
#elif _WIN64
        const string DLL_NAME = "uFCoder-x86_64.dll"; // for x64 target
#else // #elif _ARM
        const string DLL_NAME = "uFCoder-arm.dll"; // for ARM target
#endif

Does anyone know what's happening right here? I tried calling my cs file from MainPage and run in debug 64/84. By right, it should change accordingly when i toggle between running in 64/84 but after moving the file to a new location it stuck at else condition all the way and the return went wrong as well. Im running this in UWP Visual studio.

  • Are you sure, that `_WIN32` or `_WIN64` macros are defined? – vasily.sib Oct 15 '18 at 02:58
  • I believe `_WIN32` and `_WIN64` not to be default defines in .Net projects. You would have to add them to your project. See https://stackoverflow.com/questions/1313402/preprocessor-directive-in-c-sharp-for-importing-based-on-platform – Dennis Kuypers Oct 15 '18 at 03:01
  • Possible duplicate of [Preprocessor directive in C# for importing based on platform](https://stackoverflow.com/questions/1313402/preprocessor-directive-in-c-sharp-for-importing-based-on-platform) – Dennis Kuypers Oct 15 '18 at 03:01
  • In the future consider giving your questions a meaningful title. This way you might find your answer in the "related" questions. – Dennis Kuypers Oct 15 '18 at 03:04
  • Noted, but i've already indicated in there. It seems like i'm unable to get the value return. –  Oct 15 '18 at 03:10

1 Answers1

0

There are no _WIN32 or _WIN64 preprocessor directives in C# out of the box. Please see #if (C# Reference)

You will have to define them yourself or use another mechanism. You could check out C# Directive to indicate 32-bit or 64-bit build


To define the symbols yourself

Solution properties -> Project properties -> Build -> Add them to Conditional compilation symbols:

enter image description here

Remember to add them to debug and release configurations.

Also, please note that this is per project, not for the whole solution.

tymtam
  • 31,798
  • 8
  • 86
  • 126