Can I use #ifdef sections in a .def file for a dll? E.g.:
LIBRARY "mydll"
EXPORTS
checkRequirements
createDevice
installDriver
isPastVersionInstalled
removeDevice
#ifdef myVar
doSomethingElse
#endif
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, not possible, it is not a file that’s pre-processed. Although I supposed you could by running the preprocessor to generate another .def file and link that one.
The more effective approach is to eliminate the need for a .def file completely. Use __declspec(dllexport) in your code on the functions that should be exported. Then any #ifdef in that code will automatically ensure that a function is neither compiled nor exported.