Return type and arguments template?

Don Clugston dac at nospam.com.au
Mon Sep 25 03:27:20 PDT 2006


Johan Granberg wrote:
> Can a function pointer or delegates arguments and return type bee 
> determined by a template. I'm trying to create bindings to another 
> language and would love to be able to export a function just by writing
> registerFunction(&functionName);

Yes, it's possible. Depending on what you want to do, you can do it the 
C++ way, with a series of templates; or for just linking you can use the 
.mangleof property. Look up 'PyD' for bindings to Python with a syntax 
like that.

> Similarly can the components of a struct or class bee extracted. (in 
> short i'm trying to build a sort of syntax tree describing the 
> fuctions/delegates)

No, you can't find the members of a class or struct at compile time. Not 
yet, anyway. At run time you can use DDL (at dsource).

BTW -- You keep making a spelling mistake, it's time someone corrected 
you. "bee" is an insect that buzzes and makes honey. The word you want 
is "be". <g>



More information about the Digitalmars-d-learn mailing list