[Qt-interest] doubt regarding creation of shared libs in QT

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon May 10 10:23:00 CEST 2010


Thiago Macieira wrote on Friday, May 07, 2010 6:33 PM:

>> ...
>> But I prefer to have explicit control what exactly is exported, with
>> the approach above, giving me this additional "package visibility"
>> level, ...
> How do you control the exporting of the virtual table and the
> typeinfo symbols? 

Well, I must admit I "skipped" the "compiler construction" classes at university, I was never really into all that "low-level stuff" (1). That said, all I know is that the resulting DLL is "slightly smaller" when you do

// export only the method 'doFoo'
class Foo {
public:
  FOO_API void doFoo();
  void doBar();
  ...
};

instead of

// export "everything"
class FOO_API Foo {
public:
  void doFoo();
  void doBar();
  ...
};

I must admit that I have never verified whether the resulting DLL is really smaller that way (as I have this knowledge from "unknown internet sources/newsgroups"). 

However what really "works" is that the "user" of the given DLL can't call doBar() in the first approach (where only doFoo is exported), because that /does/ result in a linker error (at least on Windows). And that is what I meant by "I prefer to have explicit control what exactly is exported", because it gives some kind of additional "package/DLL visibility" :)

But what exactly the compiler does with the virtual tables and the typeinfo symbols (an area where my knowledge becomes really sketchy) I don't know - and from my point of view as a C++/Qt (nowadays mostly Java :/ ) application developer "I don't want to know" - well, actually it would be interesting to know ;)

Cheers,
  Oliver

(1) "low level": everything which is below C and OpenGL ;)
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list