Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-5678

mongoc_log_func_t is missing __cdecl

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Major Change
    • C Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      The mongoc_log_func_t typedef is used in the parameters of exported function symbols declared with __cdecl (including mongoc_log_default_handler) but is not declared with __cdecl, meaning a different default calling convention (e.g. __vectorcall with /Gv) changes the calling convention of the mongoc_log_func_t type and dependent exported function symbols. This means the following program fails to link with /Gv:

      void broken(void) {
        // error: mongoc_log_default_handler is declared with __cdecl, but due to /Gv,
        //        mongoc_log_set_handler requires a function pointer with __vectorcall
        //        because mongoc_log_func_t is missing __cdecl, so mongoc_log_default_handler
        //        is not considered a valid argument (incompatible pointer types).
        mongoc_log_set_handler(&mongoc_log_default_handler, NULL);
      }
      

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            ezra.chung@mongodb.com Ezra Chung
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None