ligzy / mp4v2

Automatically exported from code.google.com/p/mp4v2
Other
0 stars 0 forks source link

Remove class exports from dll file #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I noticed, that dll built for windows exports all functions/procedures and 
classes as well. If dll is not used from C++, then export of all classes is not 
necessary and just increases the size of dll. What I did is I removed exports 
of classes and was able to reduce file size from 688128 to 614400 bytes. Not a 
big deal, but anyway. Implementation idea is like this:

I introduced new #define in file include/mp4v2/platform.h and gave it dummy 
value

#define MP4V2_CLASS_EXPORT /**/  

and replaced MP4V2_EXPORT with MP4V2_CLASS_EXPORT in all .h files.

I'm not C++ expert ;) I guess there could be a better solution, but this just 
and idea.

I attached .diff file as well, just in case.

Eriks

Original issue reported on code.google.com by eriks.al...@gmail.com on 22 Sep 2010 at 8:53

Attachments:

GoogleCodeExporter commented 9 years ago
I replaced in all .h file

class MP4V2_EXPORT with class MP4V2_CLASS_EXPORT
struct MP4V2_EXPORT with struct MP4V2_CLASS_EXPORT

Original comment by eriks.al...@gmail.com on 22 Sep 2010 at 9:02

GoogleCodeExporter commented 9 years ago
Is the goal to reduce mp4v2 library size?  Or are you proposing this change for 
some other reason?

For the sake of simplicity/compatibility, I'm not going to add this change.  
There are project settings that would possibly be involved, and clients would 
also need to be in sync (and I don't have control over that).  I don't think 
~70KB is worth the potential risks involved with making mp4v2 dlls that don't 
necessarily contain C++ exports.  Also, I think the possibility of breaking 
existing projects using mp4v2 is very, very high.

If there were a new #define, it should be that by default the classes are 
exported unless some "no class exports" type of thing is defined (so that you 
have to go out of your way to disable class exports rather than go out of your 
way to enable it).  

Of course, you're welcome to make these changes locally.

Original comment by kid...@gmail.com on 22 Sep 2010 at 5:15