digitalmars.D.ide - ModuleInfo missing
- stefv (38/38) Jul 17 Hello,
- Richard (Rikki) Andrew Cattermole (13/13) Jul 17 What you are attempting to do is what I refer to as positive annotation
- stefv (7/23) Jul 17 Thank you: it's working.
Hello,
I'm creating an application using Windows. This application is
using an EXE and a DLL. I'm using VisualD with Visual Studio
Community 2022 and LDC2.
But I have this error:
```
Build started at 13:24...
------ Build started: Project: BugModuleInfoDll, Configuration:
Debug LDC x64 ------
Building C:\Projets\dlang\dlang_moduleinfo\x64\Debug
LDC\BugModuleInfoDll.dll...
Creating library C:\Projets\dlang\dlang_moduleinfo\x64\Debug
LDC\BugModuleInfoDll.lib and object
C:\Projets\dlang\dlang_moduleinfo\x64\Debug
LDC\BugModuleInfoDll.exp
------ Build started: Project: BugModuleInfoExe, Configuration:
Debug LDC x64 ------
Building C:\Projets\dlang\dlang_moduleinfo\x64\Debug
LDC\BugModuleInfoExe.exe...
BugModuleInfoExe.obj : error LNK2001: unresolved external symbol
"BugModuleInfoDll.__ModuleInfo"
(_D16BugModuleInfoDll12__ModuleInfoZ)
C:\Projets\dlang\dlang_moduleinfo\x64\Debug
LDC\BugModuleInfoExe.exe : fatal error LNK1120: 1 unresolved
externals
Error: C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64\link.exe failed
with status: 1120
Building C:\Projets\dlang\dlang_moduleinfo\x64\Debug
LDC\BugModuleInfoExe.exe failed (error code 1)!
Details saved as
"file://C:\Projets\dlang\dlang_moduleinfo\BugModuleInfoExe\x64\Debug%20LDC\BugModuleInfoExe.buildlog.html"
```
The use case project is on this GIT repo:
https://github.com/stefv/dlang_moduleinfo
I found some threads about similar problems but I can't find a
solution.
Thank you for your help.
Stef
Jul 17
What you are attempting to do is what I refer to as positive annotation exportation. Where you annotate what you want exported and accessible outside the current binary. This does not work in D for D style code like you have written. The recommended method is to use what I call negative annotation. By applying the dllimport override switch set to all, ``-dllimport=all``, and the visibility modifier switch to public ``-visibility=public``. You will need to set dllimport on both executable and shared library. The visibility override switch only needs to be set on the shared library. You will likely also need to set on both executable and shared library that you want the shared runtime+phobos via ``--link-defaultlib-shared``.
Jul 17
On Thursday, 17 July 2025 at 17:18:04 UTC, Richard (Rikki) Andrew Cattermole wrote:What you are attempting to do is what I refer to as positive annotation exportation. Where you annotate what you want exported and accessible outside the current binary. This does not work in D for D style code like you have written. The recommended method is to use what I call negative annotation. By applying the dllimport override switch set to all, ``-dllimport=all``, and the visibility modifier switch to public ``-visibility=public``. You will need to set dllimport on both executable and shared library. The visibility override switch only needs to be set on the shared library. You will likely also need to set on both executable and shared library that you want the shared runtime+phobos via ``--link-defaultlib-shared``.Thank you: it's working. The flag visibility didn't work with LDC2. I used: --fvisibility=public Regards, Stef
Jul 17








stefv <s1234567 gmail.Com>