|
Boost : |
From: Luke Elliott (luke_elliott_at_[hidden])
Date: 2005-08-24 11:17:27
Nigel Stewart wrote:
>>>>>However, the warnings can be removed by exporting only members which
>>>>>truly need to be exported
>
>
>>>> I would be a bit reluctant about "pollution"
>
>
>>>Have you seen the boost header files?! :)
>
>
>>There are some other benefits: smaller binaries, the optimizer seems to
>>do a better job...
>
>
> Sounds interesting, any further information available?
>
> Nigel
Whoops! Try again...
With:
class MY_LIB_API my_class
{
public:
void some_fn();
void some_inline_fn()
{
++m_i;
}
int get()
{
return m_i;
}
private:
int m_i;
};
dumpbin /exports exports.dll
Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file exports.dll
File Type: DLL
Section contains the following exports for exports.dll
00000000 characteristics
430C9B5E time date stamp Wed Aug 24 11:07:58 2005
0.00 version
1 ordinal base
4 number of functions
4 number of names
ordinal hint RVA name
1 0 00001020 ??4my_class@@QAEAAV0_at_ABV0@@Z
2 1 00001010 ?get_at_my_class@@QAEHXZ
3 2 00001000 ?some_fn_at_my_class@@QAEXXZ
4 3 00001000 ?some_inline_fn_at_my_class@@QAEXXZ
So the "inline" functions are actually exported from the dll. Whereas:
class my_class
{
public:
MY_LIB_API void some_fn();
void some_inline_fn()
{
++m_i;
}
int get()
{
return m_i;
}
private:
int m_i;
};
dumpbin /exports exports.dll
Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file exports.dll
File Type: DLL
Section contains the following exports for exports.dll
00000000 characteristics
430C9BA8 time date stamp Wed Aug 24 11:09:12 2005
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00001000 ?some_fn_at_my_class@@QAEXXZ
You only get the explicitly exported methods. All makes sense, I suppose.
As far as optimizations go, I've seen that a client of a dll may not use
an inline method and may make an actual dll call if the inline method is
declspeced. I just tried that with a simple example and of course
couldn't demonstrate it...
Luke.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk