Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDMD: -g switch produces linker error #429

Open
dlang-bugzilla-migration opened this issue Jan 9, 2021 · 0 comments
Open

RDMD: -g switch produces linker error #429

dlang-bugzilla-migration opened this issue Jan 9, 2021 · 0 comments
Labels
Prio.3.Normal A bug that is neither a blocker nor a regression T.RDMD Issues that apply only to rdmd Type.Bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense

Comments

@dlang-bugzilla-migration

Transferred from: https://issues.dlang.org/show_bug.cgi?id=15533

User golovanov_alexey reported (2016-Jan-09 09:34:01):

Created attachment 1572

reduced test case (see moduleB import)

From forum: http://forum.dlang.org/thread/[email protected]

OS: Windows 7 (32 bit)
DMD: 2.069.2 and 2.070.0-b1
RDMD: build 20160103

Problem: import inside function produced linker error then -g switch used.
Test files in attach:

moduleA.d
test\moduleB.d
test\moduleC.d

module moduleA;

public void funcA () {
  import test.moduleB: funcB;
  return;
}

void main(string[] args) {
  return;
}
module test.moduleB;

//import test.moduleC: funcC;  //this works

public void funcB () {
  import test.moduleC: funcC;  //linker error
  funcC();

  return;
}
module test.moduleC;

public void funcC () {
  return;
}
C:\dmd2\windows\bin\rdmd.exe moduleA.d
//no errors, moduleA.exe created


C:\dmd2\windows\bin\rdmd.exe -g moduleA.d
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\Users\user\AppData\Local\Temp\.rdmd\rdmd-moduleA.d-D3D7676836384146D1D9D907CF20EC26\objs\moduleA.exe.obj(moduleA.exe)
 Error 42: Symbol Undefined _D4test7moduleC5funcCFZv
--- errorlevel 1

Problem disappear, then i move import in test.moduleB to global level:

module test.moduleB;

import test.moduleC: funcC;  //this works

public void funcB () {
  //import test.moduleC: funcC;  //linker error
  funcC();

  return;
}

User golovanov_alexey responded (2016-Jan-16 09:34:43):

RDMD in both cases produces same rdmd.deps file in corresponding work dir.
And those rdmd.deps not contains any mention of moduleC.

Command dmd -deps=moduleA.deps moduleA.d
produces moduleA.deps file, which not contains any mention of moduleC too.

Is this DMD bug instead of RDMD ?

User golovanov_alexey responded (2016-Jan-16 16:57:47):

It seems this is old DMD bug
"https://issues.dlang.org/show_bug.cgi?id=7016 - local import does not create -deps dependency"

User golovanov_alexey responded (2017-May-20 10:36:09):

No. Issue 7016 fixed, but this 15533 sill exists.

DMD32 D Compiler v2.075.0-master-f546675.
Reduced test case.

C:\dmd2\windows\bin\rdmd.exe moduleA.d
//no errors, moduleA.exe created


C:\dmd2\windows\bin\rdmd.exe -g moduleA.d
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\Users\gav\AppData\Local\Temp\.rdmd\rdmd-moduleA.d-8C1729D9769E4E70D93C65D738058ED2\objs\moduleA.exe.obj(moduleA.exe)

 Error 42: Symbol Undefined _D4test7moduleC5funcCFZv
Error: linker exited with status 1

Reproduced locally (OSX), the code works with dmd -i but not with rdmd.

@dlang-bugzilla-migration dlang-bugzilla-migration added Type.Bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense Prio.3.Normal A bug that is neither a blocker nor a regression T.RDMD Issues that apply only to rdmd labels Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio.3.Normal A bug that is neither a blocker nor a regression T.RDMD Issues that apply only to rdmd Type.Bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense
Projects
None yet
Development

No branches or pull requests

1 participant