extern(C++) and shared

Jude Young 10equals2 at gmail.com
Sun Nov 27 04:17:13 PST 2011


On Sun 27 Nov 2011 05:54:27 AM CST, deadalnix wrote:
> Le 27/11/2011 12:02, Jacob Carlborg a écrit :
>> On 2011-11-27 01:20, deadalnix wrote:
>>> I have this function :
>>> extern(C++) void* __dsfml_start_thread(EntryPoint entryPoint, void*
>>> userData);
>>>
>>> If EntryPoint is defined as follow :
>>> alias extern(C++) void* function(void*) EntryPoint;
>>>
>>> The function mangle in _Z20__dsfml_start_threadPFPvS_ES_
>>>
>>> if alias extern(C++) void* function(shared void*) EntryPoint;
>>> _Z20__dsfml_start_threadPFPvPvES_
>>>
>>> Both demangle using c++filt in __dsfml_start_thread(void* (*)(void*),
>>> void*), which is what is expected.
>>>
>>> But the definition without shared will be the only one to link
>>> successfully.
>>>
>>> Is the mangling of shared types is consistent in C++ ? shared doesn't
>>> exists in C++, so I guess we should expect the same mangling in both
>>> cases. Unless it exists some magic on the C++ side that I'm not aware
>>> of ?
>>
>> Have you tried with __gshared instead?
>>
>
> It doesn't compile at all with __gshared. I have the following error :
> basic type expected, not __gshared
>
extern (C++)
{
__gshared type function(blah) blah;
alias foo bar;?
}
that doesn't work?


More information about the Digitalmars-d mailing list