D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20153 - extern for aliased template instantiation
Summary: extern for aliased template instantiation
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-22 15:08 UTC by a11e99z
Modified: 2024-12-13 19:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description a11e99z 2019-08-22 15:08:26 UTC
I want to export non-mangled instantiated through alias template function.
it can be useful for WASM, DLLs/SharedLibs and etc.
but alias for template instatiation is ignored.
pragma mangle to alias is ignored too.

-----------------------------------
void main() {}

export:                  // EXPORTed
extern (C):              // NO MANGLE but IGNORED
public:

void fun( Char )( Char* ) { }

pragma (mangle, "func")  // IGNORED
alias func = fun!char;
pragma( msg, func.mangleof );

pragma (mangle, "funw")  // IGNORED
alias funw = fun!wchar;
pragma( msg, funw.mangleof );

------------ OUTPUT -----------------------
_D9onlineapp__T3funTaZQhUNaNbNiNfPaZv
_D9onlineapp__T3funTuZQhUNaNbNiNfPuZv


current workaround: wrap template funcs to non-template.

possible solution:
if "alias" locates in non-mangle block (extern(C) for example) then do not mangle name and check that no others entities with same name exists in current context.
OR/AND
make "pragma mangle" working for alias-es too.
Comment 1 dlangBugzillaToGithub 2024-12-13 19:05:06 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19612

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB