Problem with coupling shared object symbol visibility with protection

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 05:48:44 PST 2015


On Wednesday, 28 January 2015 at 13:30:17 UTC, Benjamin Thaut 
wrote:
> On Wednesday, 28 January 2015 at 11:42:19 UTC, Dicebot wrote:
>>
>> 2) first proposed solution does not allow to mark private 
>> functions as "export". It implicitly exports those if they are 
>> needed for actual public/export template function to work. 
>> This is not the same - those functions still can't be called 
>> via provide .di binding, it simply keeps them available for 
>> linking.
>
> So you would prefer to keep symbols private and just make them 
> available for linking? Or what exactly is the message here?

Isn't that what your first proposed solution is about? That was 
my understanding and I liked that understanding :) To be 100% 
clear :

export void foo(T : int)(T x)
{
     bar(x);
}

private void bar(int x) { }

I'd expect `bar` to be exported into resulting binary so that it 
can be linked against by any users of `foo` but for any attempt 
to call `bar` directly from D code to fail because of protection 
violation. If someone wants to circumvent protection by forging 
mangling - shooting own feet is allowed.


More information about the Digitalmars-d mailing list