Replies: 3 comments 10 replies
-
Linking with
|
Beta Was this translation helpful? Give feedback.
-
Exporting symbols form DLLGCC runs with a command-line switch to exports all symbols in a DLL that are exported by all individual C modules used to build the DLL. Clang and MSVC require the DLL-exported symbols be specified in a DEF file or labeled with attribute The However, this only applies to functions/data actually defined in the stubs that include those declarations. It does not apply to extra functions/data that are defined in the stub code, nor to the jumptable symbols ("global" symbols in the assembly code). In the end, I ended up by reusing the #pragma clang attribute push (__declspec(dllexport), apply_to=function)
// exported functions...
#pragma clang attribute pop Other compilers than Clang are obliged to silently ignore |
Beta Was this translation helpful? Give feedback.
-
Duplicate data definitionsThe GCC is configured to allow duplicate data definitions in different modules through the command-line switch There are two places where Ironclad uses duplicate data definitions. One is in the generated header file The other place is |
Beta Was this translation helpful? Give feedback.
-
I'm starting a new topic here to keep findings and discussion related to the migration to Clang separate from the general discussion on Ironclad 3.
The major benefit from using Clang is that it can produce
.pdb
files, while GCC cannot. Also using Clang rather than MSVC should make porting to other systems easier. For Windows, however, I useclang-cl
, which is aclang
driver providing compatibility withcl
(MSVC compiler). Also, for linking I uselld
which replacesld
, GCC linker. Here too, the actual linker command islld-link
, which provides compatibility withlink
(MSVC linker). Using MSVC directly is not feasible because the 64-bit MSVC v.1600 (aka 10.0, or VS 2010, used to compile CPython 3.4) is not freely available. Clang, however, can impersonate MSVC v.1600. I'm using Clang version 16.0.5.The current status is that both
ic_msvcr90.dll
andpython34.dll
are being built with Clang and have corresponding PDB files produced. Tested with VS2022 (ver. 17.7.6): breakpoints in native code work, also stepping through from managed to native works fine. The migration work is done on branch ipy3-clang, which I try to keep rebased on main, until it is stable, proven, and ready to be merged into main. So far so good, so in the coming time I intend to have all Ironclad's native code built with Clang. During the migration I have encountered three significant differences between GCC and Clang that affect the project.ld
) can link with "naked" DLLs, Clang (lld-link
), likelink
, requires an import library..def
file or adllexport
declaration on exported functions.ld
can ignore duplicate data definitions, discarding all but the first encountered.lld-link
, likelink
requires exactly one.Pro memoria, I will address all these points in more detail in separate posts.
Beta Was this translation helpful? Give feedback.
All reactions