Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 17, 2020 lambda alias import | ||||
---|---|---|---|---|
| ||||
stuff.d: alias doStuff = () {}; main.d: import stuff; void main() { doStuff(); } DMD throws compile error: Error 42: Symbol Undefined __D5stuff9__lambda3FNaNbNiNfZv Is this expected behavior? It tripped me while trying to use DerelictVulkan :( |
January 17, 2020 Re: lambda alias import | ||||
---|---|---|---|---|
| ||||
Posted in reply to JN | On Friday, 17 January 2020 at 21:40:05 UTC, JN wrote:
> stuff.d:
>
> alias doStuff = () {};
>
> main.d:
>
> import stuff;
>
> void main()
> {
> doStuff();
> }
>
>
> DMD throws compile error:
>
> Error 42: Symbol Undefined __D5stuff9__lambda3FNaNbNiNfZv
>
> Is this expected behavior? It tripped me while trying to use DerelictVulkan :(
I think the problem comes from the way you compile and link your code. I you compile both modules together like this it should work out:
dmd -ofresult main.d stuff.d
(I'm on the phone, so I can't verify if it works atm)
|
January 17, 2020 Re: lambda alias import | ||||
---|---|---|---|---|
| ||||
Posted in reply to Petar Kirov [ZombineDev] | On Friday, 17 January 2020 at 23:04:57 UTC, Petar Kirov [ZombineDev] wrote: > [..] *If* you compile both modules .. > [..] |
January 17, 2020 Re: lambda alias import | ||||
---|---|---|---|---|
| ||||
Posted in reply to Petar Kirov [ZombineDev] | On 1/17/20 3:04 PM, Petar Kirov [ZombineDev] wrote:> On Friday, 17 January 2020 at 21:40:05 UTC, JN wrote: > I think the problem comes from the way you compile and link your code. I > you compile both modules together like this it should work out: > > dmd -ofresult main.d stuff.d If that's the solution, some people may find a relatively less known dmd command line switch useful: -i: -i[=<pattern>] include imported modules in the compilation Ali |
January 17, 2020 Re: lambda alias import | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Fri, Jan 17, 2020 at 04:12:18PM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 1/17/20 3:04 PM, Petar Kirov [ZombineDev] wrote:> On Friday, 17 January 2020 at 21:40:05 UTC, JN wrote: > > > I think the problem comes from the way you compile and link your code. I you compile both modules together like this it should work out: > > > > dmd -ofresult main.d stuff.d > > If that's the solution, some people may find a relatively less known dmd command line switch useful: -i: > > -i[=<pattern>] include imported modules in the compilation [...] Yeah, -i has been a super-convenient thing to use. For unittesting individual modules, etc., I can just `dmd -i -unittest -main -run module.d` and it Just Works(tm). It's awesome. Highly recommended. T -- A programming language should be a toolbox for the programmer to draw upon, not a minefield of dangerous explosives that you have to very carefully avoid touching in the wrong way. |
Copyright © 1999-2021 by the D Language Foundation