[cfe-commits] MS pure virtual call ABI

Timur Iskhodzhanov timurrrr at google.com
Wed Jun 27 13:25:52 PDT 2012


This is what I got on the trunk version of Clang:
pure_virtual-439031.o : error LNK2019: unresolved external symbol
"const B::`vftable'" (??_7B@@6B@) referenced in function "public:
__thiscall B::B(void)" (??0B@@QAE at XZ)
pure_virtual-439031.o : error LNK2019: unresolved external symbol
"const A::`vftable'" (??_7A@@6B@) referenced in function "public:
__thiscall A::A(void)" (??0A@@QAE at XZ)
:)

Actually I believe the mentioned MSDN doc [1] is enough to get *some*
implementation working.
The prototype of the function is the same as __cxa_pure_virtual [2] so
it should be enough to just use a different function name when
compiling with "-cxx-abi microsoft".
If we observe any problems later we can come up with another short
repro and just fix it.

[1] http://msdn.microsoft.com/en-us/library/ff798096.aspx
[2] http://stackoverflow.com/questions/920500/what-is-the-purpose-of-cxa-pure-virtual

On Wed, Jun 27, 2012 at 10:25 AM, John McCall <rjmccall at apple.com> wrote:
> On Jun 26, 2012, at 11:25 PM, João Matos wrote:
>> Chandler, most of the details of the MS ABI are not publicly
>> documented, as far as I know there is no spec.
>>
>> The only reference I can find is this:
>> http://msdn.microsoft.com/en-us/library/ff798096.aspx
>
> As an alternative to finding a spec, if you can clearly demonstrate that the
> observable behavior of calling a pure virtual function is to call this particular
> function, then I believe we can accept this.  For example, what happens
> when you run this program?
>
> struct A {
>  virtual void foo() = 0;
>  A() { foo(); }
> };
> struct B : A{
>  void foo() {}
> };
> int main() {
>  B b;
> }
>
> John.
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list