For DLLs, what does export actually do?

Ben Davis entheh at cantab.net
Sat Feb 9 18:03:09 PST 2013


On 09/02/2013 20:39, Benjamin Thaut wrote:
> Am 09.02.2013 21:35, schrieb Ben Davis:
>> Hi,
>>
>> I'm working on a multimedia driver DLL, i.e. one that Windows loads on
>> behalf of any program that uses the Windows multimedia API.
>>
>> I'm using a .def file with an EXPORTS section, and I've also got all the
>> relevant functions marked as 'export' in the code.
>>
>> What I'm finding is, if I remove the 'export' attribute but keep the
>> EXPORTS section, it all still works; but if I keep the 'export'
>> attribute and remove the EXPORTS section, then it doesn't work.
>>
>> Just wondering why this is, and whether the 'export' attribute is
>> actually programmed to do anything at the moment :)
>>
>> Thanks,
>>
>> Ben :)
>
> Yes it is, but its only working properly for global functions. It works
> partially for classes and not at all for all remaining cases. The export
> attribute is currently only usefull if you want to do a C-Style
> interface for your Dll.

My functions are "export extern (Windows)" - I think they're global...?

For example:

export extern(Windows) LRESULT DriverProc(DWORD_PTR dwDriverId, HDRVR 
hdrvr, UINT msg, LONG lParam1, LONG lParam2) nothrow { ... }


More information about the Digitalmars-d-learn mailing list