What does 'inline' mean?
Steven Schveighoffer
schveiguy at gmail.com
Thu Jun 11 15:16:10 UTC 2020
On 6/11/20 6:05 AM, Walter Bright wrote:
> On 6/10/2020 1:10 PM, kinke wrote:
>> TLDR: Templates, with the current emission scheme, can definitely not
>> be used to emit a function into every referencing CU.
>
> Yes, but in Manu's case the idea is to not need to link with a library.
> It's hard to see how the compiler would know that a template was
> instantiated in a library - meaning it'll emit an instance for at least
> one of the modules given on the command line.
>
> That should resolve the particular issue Manu was having.
An example:
--- b.d:
module b;
int foo(T)()
{
return 1;
}
enum x = foo!int();
--- a.d:
import b;
void main()
{
auto = foo!int();
}
---
> dmd a.d
Undefined symbols for architecture x86_64:
"__D1b__T3fooTiZQhFNaNbNiNfZi", referenced from:
__Dmain in a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Error: linker exited with status 1
comment out the enum and it works.
-Steve
More information about the Digitalmars-d
mailing list