On Tue, Jan 16, 2001 at 08:58:26AM +0100, Valeri Todorov wrote:
> Perhaps I didn't express myself very well. Yes, you are absolutely right about
> what you saying, but what I had in mind is that you need to create an instance
> of an object somehow. The problem arise that you have to use expressions like
> nsComponentManager::CreateInstance. If library module containing this method
> is compiled with one compiler, and you try to use it from an application
> written with different one, then you will get a link error. On the other hand,
> if the previous statement is declared like
> extern "C" NS_RESULT nsCreateInstance(arg,arg) then things become compiler
> independent as long as compiler support vtbl compatible with one used to build
> mozilla itself.
nsComponentManager::CreateInstance is a static function. Those work fine
afaik -- the calling convention is the same as for C functions.
>
> Anyway this is pure theory, since there are plenty of other thinfs like
> nsString which will make things incompatible between compilers :(
>
Is the MS COM CString implemented with all static functions? (a "C" string
object? it's been too long since i used it).
It doesn't matter. Not everything has to be a COM object (in the sense of
"implement IUnknown"). As long as you declare it with the __declspec
nonsense, it will be in the COM object format. The only time you need to be
an IUnknown is if you need rtti (which is overused anyhow, imho). So utility
objects should be fine.
Obviously that makes any utility that doesn't declare its methods right ...
buggy :)
Cheers,
ari