<div class="gmail_extra"><div class="gmail_quote">On 5 May 2012 09:09, Artur Skawina <span dir="ltr"><<a href="mailto:art.08.09@gmail.com" target="_blank">art.08.09@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 05/05/12 01:32, Manu wrote:<br>
<div><div class="h5">> On 4 May 2012 21:51, Artur Skawina <<a href="mailto:art.08.09@gmail.com">art.08.09@gmail.com</a> <mailto:<a href="mailto:art.08.09@gmail.com">art.08.09@gmail.com</a>>> wrote:<br>
><br>
>     On 05/04/12 15:57, Manu wrote:<br>
>     > Yeah I really hate this too. I'd like to see const(T) strictly enforced, considering the potential for ambiguity in other situations.<br>
>     ><br>
>     > But I'm still stuck! :(<br>
>     > How can I do what I need to do?<br>
><br>
>     If 'auto' is not an option:<br>
><br>
>       alias ref const(S) function() FT;<br>
>       FT fp;<br>
><br>
>     (it's needed for things like 'extern (C)' too)<br>
><br>
><br>
> Huzzah! This is indeed the solution! I haven't seen another solution that works. now I just need to make sure I generate a unique name for the alias...<br>
><br>
> I don't think this is needed for extern (C), I declare extern (C) function pointers all the time without any trick..?<br>
<br>
</div></div>   void f(extern (C) int function(double) a);<br></blockquote><div><br></div><div>Hmm, actually, this makes me question my code...</div><div><br></div><div>struct Thing</div><div>{</div><div>  extern (C) void function() funcPtr;</div>
<div>}</div><div><br></div><div>Have I declared a pointer to an extern(C) function, or have I declared an extern(C) variable funcPtr that is a regular D-call function?</div><div>extern(C) variables only really make sense in the global scope, where they would have C-style name mangling applied...</div>
</div></div>