pragma(mangle, "name") suggestion !
Calvin P
changlon at gmail.com
Thu Mar 19 05:56:50 UTC 2020
On Thursday, 19 March 2020 at 05:34:10 UTC, Mathias Lang wrote:
> Or just use:
> template myAction(string name)
> {
> pragma(mangle, name ~ "_myAction")
> void myAction(ubyte[][] fields) ()
> {
> ]
> }
>
>
> Although if you need to use such trick, I would recommend you
> to reorganize your code.
> Do you have a link to the code ?
Thanks for the very kind tips. I can not provide link to code
right now.
Why I need this is because there is at lease 3 level embed
function to provide ctfe && runtime Joint processing. each
step depend last steps ctfe result and runtime results.
It is doable to move them out( pass all the middle generate enum
result and runtime result into global template), but with this
the code will being hard to reading.
for example:
=========
auto getMyRactor(alias App)(Config config){
enum APP_RULES = getUDERules!(App);
void myAction(ubyte[][] fields) (){
static if( APP_RULES.a && !APP_RULES.b ) {
} else {
}
}
config.handle = &myAction;
App app;
app.setConfig(config);
return app;
}
=========
the point is there is 3 level function need to been passed as
function address, and they depend on the uplevel enum const and
runtime arguments.
I will think about it to try if I can reorganize it to better
shape.
More information about the Digitalmars-d
mailing list