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

mongoc_log_func_t is missing __cdecl

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • C Drivers

      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:
            Unassigned Unassigned
            Reporter:
            ezra.chung@mongodb.com Ezra Chung
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: