[ofw] [PATCH] winverbs: use export/import functions appropriately

Fab Tillier ftillier at microsoft.com
Thu Sep 2 12:24:03 PDT 2010


Why not use the syntax:

#ifdef __cplusplus
extern "C" {
#endif

<declarations all go here...>

#ifdef __cplusplus
}
#endif

This would avoid duplicating the declarations...  Not a big deal when there's a single function, but if there are more functions it prevents bugs from being introduced due to some declarations being forgotten when changes are made.

-Fab

Hefty, Sean wrote on Thu, 2 Sep 2010 at 12:17:30

> Winverbs defines WvGetObject that users must invoke to obtain the
> winverb provider interface.  WvGetObject is defined in the header
> files as dllexport, but callers require dllimport.  The winverbs
> sources file already defines EXPORT_WV_SYMBOLS that is intended to
> distinguish if we are really trying to export or import WvGetObject.
> Update winverbs.h to support dllimport for clients including
> winverbs directly.
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> Several other headers have a similar issue.  Just fixing winverbs
> for now.
> 
> Index: winverbs.h
> =================================================================== ---
> winverbs.h	(revision 2870) +++ winverbs.h	(working copy) @@ -1542,10
> +1542,16 @@
>  		) PURE;
>  };
> +#ifdef EXPORT_WV_SYMBOLS
> +#define WV_EXPORT __declspec(dllexport)
> +#else
> +#define WV_EXPORT __declspec(dllimport)
> +#endif
> +
>  #ifdef __cplusplus
> -extern "C" __declspec(dllexport) HRESULT WvGetObject(REFIID riid,
> LPVOID FAR* ppvObj);
> +extern "C" WV_EXPORT HRESULT WvGetObject(REFIID riid, LPVOID FAR*
> ppvObj);
>  #else
> -__declspec(dllexport) HRESULT WvGetObject(REFIID riid, LPVOID FAR*
> ppvObj); +WV_EXPORT HRESULT WvGetObject(REFIID riid, LPVOID FAR* ppvObj);
>  #endif
>  
>  #endif // _WINVERBS_H_
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw



More information about the ofw mailing list