We recommend using Visual Studio 2017



The latest version of this topic can be found at idl_module.

Specifies an entry point in a .dll file.

      [ idl_module (   
   helpstring="help text",   
) ]  
function declaration  


A user-defined name for the code block that will appear in the .idl file.

dllname (optional)
The .dll file that contains the export.

uuid (optional)
A unique ID.

helpstring (optional)
A character string used to describe the type library.

helpstringcontext (optional)
The ID of a help topic in an .hlp or .chm file.

helpcontext (optional)
The Help ID for this type library.

hidden (optional)
A parameter that prevents the library from being displayed. See the hidden MIDL attribute for more information.

restricted (optional)
Members of the library cannot be arbitrarily called. See the restricted MIDL attribute for more information.

function declaration
The function that you will define.

The idl_module C++ attribute lets you specify the entry point in a .dll file, which allows you to import from a .dll file.

The idl_module attribute has functionality similar to the module MIDL attribute.

You can export anything from a COM object that you can export from a .dll file by putting a DLL entry point in the library block of an .idl file.

Your must use idl_module in two steps. First, you must define a name/DLL pair. Then, when you use idl_module to specify an entry point, specify the name and any additional attributes.

The following code shows how to use the idl_module attribute:

// cpp_attr_ref_idl_module.cpp  
// compile with: /LD  
[idl_quote("midl_pragma warning(disable:2461)")];  
[module(name="MyLibrary"), idl_module(name="MyLib", dllname="xxx.dll")];  
[idl_module(name="MyLib"), entry(4), usesgetlasterror]  
void FuncName(int i);  

Attribute Context

Applies toAnywhere
Required attributesNone
Invalid attributesNone

For more information, see Attribute Contexts.

IDL Attributes
Stand-Alone Attributes
Attributes Samples