问题
I have taken over the use of an existing FPGA verification system. It uses an Opal Kelly software (Windows) that provides a C++ programming API to perform I/O on an FPGA. The system runs on a Windows machine but is initiated through a Cygwin terminal. When I want to run a simulation, I invoke a script using a command line with the switch "-hdl" to use Opal Kelly simulation libraries in Modelsim; when I want to run a test in hardware, I compile a different set of Opal Kelly-provided source files by using a "-lab" switch in the command line argument.
We needed to replace the computer that was controlling the FPGA, and the same code that works on an older machine no longer works on the new machine. Basically, I need to select the branch of code that loads the windows DLL:
#if defined(_WIN32)
#if !defined(okLIB_NAME)
#define okLIB_NAME "okFrontPanel.dll"
#endif
#elif defined(__APPLE__)
#include <dlfcn.h>
#define okLIB_NAME "libokFrontPanel.dylib"
#elif defined(__linux__)
#include <dlfcn.h>
#define okLIB_NAME "./libokFrontPanel.so"
#endif
I expect to execute the first branch (_WIN32). The old system (Cygwin v1.5.25 , g++ v3.4.4 ) executes the first branch even though the _WIN32 variable is not in the list I get from using the -dM -E switch with g++. The new system (Cygwin v1.7.27, g++ v4.8.2) does not execute this branch.
Does anyone know of a Cygwin or g++ update that would break this functionality? I can get around this by adding
|| defined (__CYGWIN__)
to the first line, but then I am modifying vendor code that works fine under an older version. I am very inexperienced with Cygwin and g++, and a skim through the FAQ didn't reveal anything obvious.
来源:https://stackoverflow.com/questions/21267670/newer-version-of-cygwin-gcc-does-not-select-win32-branch-but-older-version-doe