[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: External (C++) interfaces
> Umpf. I don't have much experience with C++, but someone told me that
> C++ uses the standard C linker to put programs together. That means
> that C++ maps any function (even overloaded ones) to a unique name.
> This is (probably) accomplished by converting each function parameter
> (ie, its type) into a string and appending them to the functions name.
> You would need to know the scrambling function that builds the linker
> names. I don't think that this function is the same for any two
> different C++ compilers.
>
> Note that this doesn't even take element function of classes into
> account.
>
> My suggestion: Don't do this, forget about it, leave it alone, save
> mankind.
Much as I would like to leave this alone, unfortunately, all the BeBox
OS functions are based on C++ classes. Thus, since this is one of my
desired target OSes, I think C++ classes are going to be pretty
important. Especially if you want to interface to the native windowing
system. The only fortunate part of the BeBox OS is that it is based
on shared libraries which hopefully have some sort of fixed entry address
for each C++ class method. This means that the naming conventions of
the linker maybe aren't that important. Of course, I haven't seen any
of the libraries specs so this is all conjecture.
> [...]
>
> In general, our life would be a lot simpler if our compiler supported
> structured returns.
>
> I'm not so keen on language extensions. If we start a discussion
> about it: I have two pet extensions of my own (concatenation of string
> constants and interface types a la Objective-C)... ;-)
I'm not so sure that structured return values are a language extension since
assignments of structured types are allowed and the language report doesn't
disallow structured return values anywhere that I could see. I think it's
just a compiler implementation issue and possibly a ETH defacto standard to
NOT allow structured returns.
What is an interface type?
> -- mva
Michael G.