locked
Universal DLL and preprocessor definitions

    Question

  • Dear all,

    I am trying to create an universal DLL that exports certain native classes for use in another DLL. After creating the project I have three projects:

    • core.windows
    • core.windowsphone
    • core.shared

    The classes that I want to export are placed in the shared part as they should be useable by both apps. I have now added a preprocessor definition CORE_EXPORT in the project properties (Preprocessor page). Unfortunately these seem not to be visible in the shared part, which does not have these settings. I need it to be able to import/export classes:

    #ifdef CORE_EXPORTS
    #  define CORE_API __declspec(dllexport)
    #else
    #  define CORE_API __declspec(dllimport)
    #endif

    Is there any way to get access to these preprocessor defines? Currently I only get compile errors that it can not import the methods of the classes, which obviously is correct as they are part of this DLL.

    Any help is appreciated!

    Jeroen

    Sunday, May 18, 2014 10:26 AM

Answers

  • The shared project is not built separately. It is built only as part of the other projects and so uses the pre-processor defines from the phone or Windows Store project.
    Sunday, May 18, 2014 12:03 PM
    Moderator
  • Kk, I noticed now that somehow the combination with WIN32 and other made the system ignore it somehow. Now I removed the WIN32 from the defines and it seem to work properly. Thanks for confirming.

    Sunday, May 18, 2014 3:17 PM

All replies

  • The shared project is not built separately. It is built only as part of the other projects and so uses the pre-processor defines from the phone or Windows Store project.
    Sunday, May 18, 2014 12:03 PM
    Moderator
  • Kk, I noticed now that somehow the combination with WIN32 and other made the system ignore it somehow. Now I removed the WIN32 from the defines and it seem to work properly. Thanks for confirming.

    Sunday, May 18, 2014 3:17 PM