DLL export of a static function

后端 未结 2 1045
说谎
说谎 2021-01-14 08:41

I have the following static function:

static inline HandVal
              StdDeck_StdRules_EVAL_N( StdDeck_CardMask cards, int n_cards )

Ca

相关标签:
2条回答
  • 2021-01-14 09:16

    You may not export that function from a DLL. static functions are equivalent to private to that file.

    You can create a method in the file that calls it and export that.

    0 讨论(0)
  • 2021-01-14 09:22

    By defining a function with static and inline you are effectively guaranteeing that it will be only in the modules that includes the definition.

    Either edit each file to remove the static inline (which might break) or change everything to use a PreProcessor directive that will allow you to have either:

    #define MYAPI static inline
    

    or

    #define MYAPI __declspec(dllexport)
    

    and then

    MYAPI HandVal StdDeck_StdRules_EVAL_N( StdDeck_CardMask cards, int n_cards )
    

    or build a set of wrappers as a seperate module which does

    __declspec(dllexport) HandVal Public_StdDeck_StdRules_EVAL_N( StdDeck_CardMask cards, int n_cards )
    {
         return StdDeck_StdRules_EVAL_N(cards, n_cards);
    }
    
    0 讨论(0)
提交回复
热议问题