Skip to content
  • Michal Privoznik's avatar
    wrapper: Alter name of dlopen function prototypes · dbcd8207
    Michal Privoznik authored
    The way our wrapper code generator works is the following:
    
    1) Libvirt public API function pointer is declared, e.g.:
    
      typedef int
      (*virDomainAttachDeviceType)(virDomainPtr domain,
                                   const char *xml);
    
      where the type name is constructed as "${funcName}Type".
    
    2) A wrapper function is generated, e.g.
    
      int
      virDomainAttachDeviceWrapper(virDomainPtr domain.
                                   const char *xml,
                                   virErrorPtr err)
    
      which inside its body has a static variable:
    
      static virDomainGraphicsReloadType virDomainGraphicsReloadSymbol;
    
      which is then set to a corresponding libvirt API via dlopen().
    
    This works beautifully, except it makes an assumption about
    naming that no longer works in our favor. Specifically, another
    part of our generator that handles generating typedefs for
    function arguments (that are enums really, though uint
    officially), uses the same naming scheme:
    
      ${funcName}$...
    dbcd8207