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

LNK2019 unresolved external symbol "void __cdecl xed_tables_init(void)" #285

Open
PavelKotov1 opened this issue Apr 4, 2022 · 2 comments

Comments

@PavelKotov1
Copy link

PavelKotov1 commented Apr 4, 2022

Hello, dear friends!
I am trying to build x32 bit xed.dll to be linked into my standalone Visual Studio 19 projects.
(x64bit xed.dll builds and links without any problem)
OS is Windows 7 x64bit.
Followind instructions, i did:
git clone https://github.com/intelxed/xed.git xed
git clone https://github.com/intelxed/mbuild.git mbuild
mkdir test
cd test
then using x32 bit python:
G:\test>"C:\Program Files (x86)\Python37-32\python.exe" ../xed/mfile.py --shared host_cpu=ia32
After that in G:\test\obj I see xed.dll and xed.lib. The dll is x32 bits, i have doublechecked it, and the import library contains xed_tables_init entry.
In the VS project i have set up VC++ directories to point to the location of the .dll and .lib files, copied .dll into the project directory, and still: when i try to link the project i see the following error message:
Error LNK2019 unresolved external symbol "void __cdecl xed_tables_init(void)"
(?xed_tables_init@@yaxxz) referenced in function _main xed32_Pavel_test C:\Users\root\source\repos\xed32_Pavel_test\main.obj 1

Can function decoration be the cause?

Also, I noticed this:
"Shared libraries and DLLs
If you build XED using the --shared object you'll get a libxed.dll on Windows. When you link against these shared objects/DLL you are required to define XED_DLL (/DXED_DLL on Windows )."
Which options must be used to create libxed.dll?
And how exactly to define XED_DLL?
Should /DXED_DLL be added to the linkers command line options?

Could somebody please help me figure it out?
Thanks in advance, any help is highly appreciated!

@ZealanL
Copy link

ZealanL commented Jun 4, 2022

Have this issue too with a static library.

Viewing the xed.lib file reveals that sure enough, it is exported, BUT with an underscore:
015 00000000 SECT3 notype () External | _xed_tables_init

However, changing the include name from "xed_tables_init" to "_xed_tables_init" does not fix the issue.

@marjevan
Copy link
Member

Hi,
The mfile.py script adds XED_DLL.

I don't see any issue with the 32-bit build or linkage, and I can't reproduce the issue.

XED includes example tools that are built and linked with the XED C library.
My advice is to use XED build scripts to build the examples and check what is missing in your process.

$ ./mfile.py clean examples --shared host_cpu=ia32
To see the detailed build/link commands, please use the verbosity option:
$ ./mfile.py clean examples --shared host_cpu=ia32 -v 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants