| _DLL_call_attr | Function (Macro Constructor)

dll.h

#define _DLL_call_attr(type,args,attr,index) (*(type (* attr) args) _DLL_entry (index))

Constructs a function definition with attributes for a DLL call.

_DLL_call_attr gets a void pointer to the location of the index-th exported symbol of the currently loaded DLL (using _DLL_entry), casts this pointer to a temporarily-defined pointer to a function which returns type, requires args as arguments, and has the attributes defined by attr, and then dereferences it. _DLL_call_attr is very similar to _DLL_call, but allows for defining function attributes, too. For example, suppose that the DLL contains the following declarations in the DLL interface section (see DLL_INTERFACE):

    void foo (int, const char *) __attribute__((__regparm__(4)));
    int bar (long) __ATTR_STD__;
    ...
    DLL_EXPORTS foo, bar

Then, to 'import' foo and bar from the DLL (assuming that it has been loaded sucessfully using LoadDLL), you should use the following defines:

    #define foo _DLL_call_attr (void, (int, const char *), 0, __attribute__((regparm(4))))
    #define bar _DLL_call_attr (int, (long), 1, __ATTR_STD__)

See also: _DLL_call, _DLL_reference, _DLL_glbvar, Declaring Attributes of Functions