How can we call a func template instance using the Mars vendor already ?

monkyyy crazymonkyyy at gmail.com
Thu Feb 19 16:30:04 UTC 2026


On Thursday, 19 February 2026 at 16:20:58 UTC, user1234 wrote:
> On Thursday, 19 February 2026 at 15:37:42 UTC, user1234 wrote:
>> [...]
>> so you'll get
>>
>>> Error: function `runnable.NG` label 
>>> `_D8runnable__T2ngVii1ZQiFNaNbNiNfZi` is undefined
>>> Error: function `runnable.NG` label 
>>> `_D8runnable__T7ngVii2ZQnFNaNbNiNfZi` is undefined
>>
>> So to keep things simples the idea is to provide a valid 
>> function identifier in the asm. I've used compiler explorer to 
>> get the __valid__ mangled version 
>> (https://godbolt.org/z/WYMqMhnWG). No luck.
>>
>> Is that even possible ?
>
> The static foreach does not seem to generate the symbols in a 
> classic way tho...
>
>> assume  CS:.text._D8runnable__T2ngVii1ZQiFNaNbNiNfZi
>
> but on the other hand the error message is not a linker one

nah its the asm block not having access to templates

```d

// The OK part
int ok(int i:1)(){return 1;}
int ok(int i:2)(){return 2;}

void OK()
{
     ulong r;
     asm
     {
         xor R8, R8;
         call ok!1;//fails
         add R8, RAX;
         call ok!2;
         add R8, RAX;
         mov r, R8;
     }
     assert(r == 3);
}
int main()
{
     OK();
     return 0;
}
```


More information about the Digitalmars-d-learn mailing list