Can i use sections #ifdefin a file .deffor dll? For instance:.
#ifdef
.def
LIBRARY "mydll" EXPORTS checkRequirements createDevice installDriver isPastVersionInstalled removeDevice #ifdef myVar doSomethingElse #endif
No, this is not possible, this is not a file that has been preprocessed. Although I suggested that you could run the preprocessor to create another .def file and link it.
A more efficient approach is to completely eliminate the need for a .def file. Use __declspec (dllexport) in your code for functions that need to be exported. Then any #ifdef in this code automatically ensures that the function is not compiled or exported.
, .def , () mydll.def.in, .def .
mydll.def.in
Linux :
cpp -DmyVar=1 mydll.def.in > mydll.def
, Windows, , .
, , , , C, , . Gcc --traditional-cpp, , .
--traditional-cpp