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

Amalgamated build should auto-define ZYDIS_STATIC_BUILD #498

Open
ajmandourah opened this issue Mar 24, 2024 · 5 comments
Open

Amalgamated build should auto-define ZYDIS_STATIC_BUILD #498

ajmandourah opened this issue Mar 24, 2024 · 5 comments
Assignees
Labels
A-build Area: Build system C-enhancement Category: Enhancement of existing features

Comments

@ajmandourah
Copy link

ajmandourah commented Mar 24, 2024

Hey, i am new to cpp and i tried using the amalgamated files but I am getting a bunch of errors when compiling my dll

 warning C4273: 'ZydisDisassembleATT': inconsistent dll link
age
.
.
.
error C2491: 'ZydisEncoderEncodeInstruction': definition of
dllimport function not allowed

i have Zydis.c and Zydis.h in the src folder and I am including it as any file.
I am also using cmake as follow.

cmake_minimum_required(VERSION 3.10.2)

set(CMAKE_CXX_STANDARD 20)

project(test)

include_directories(./src)
file(GLOB SRC_LIST ./src/*.cpp ./src/*.def ./src/*.c)
add_library(test SHARED ${SRC_LIST})

I tried looking arond hoping for guidance . Thanks

@mappzor
Copy link
Contributor

mappzor commented Mar 24, 2024

I don't use amalgamated version but dllimport error suggests you forgot to define ZYDIS_STATIC_BUILD (#421, #370).

@ajmandourah
Copy link
Author

I don't use amalgamated version but dllimport error suggests you forgot to define ZYDIS_STATIC_BUILD (#421, #370).

Thanks for the reply

I am still confused as from what i understood that the amalgamated files contains also zycore? its stated that I only need the src and the header file but still cant compile.

I will try to compile other way but i wish to use the amalgameted files for the ease of transfer

@mappzor
Copy link
Contributor

mappzor commented Mar 25, 2024

ZYDIS_STATIC_BUILD is preprocessor definition. In CMake that would be add_compile_definitions(ZYDIS_STATIC_BUILD).

@ajmandourah
Copy link
Author

you are a lifesaver. Thanks. it compiles now

@athre0z athre0z changed the title using the amalgamated files Amalgamated build should auto-define ZYDIS_STATIC_BUILD Mar 25, 2024
@athre0z athre0z reopened this Mar 25, 2024
@athre0z
Copy link
Member

athre0z commented Mar 25, 2024

I think we should adjust the amalgamation script to automatically define those: I think it's safe to assume that pretty much no one will want to use the amalgamated sources to build a DLL. We can also offer ZYDIS_DYNAMIC_BUILD for these rare cases (specific to the amalgamated build).

@athre0z athre0z added C-enhancement Category: Enhancement of existing features A-build Area: Build system labels Mar 25, 2024
@athre0z athre0z self-assigned this Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build Area: Build system C-enhancement Category: Enhancement of existing features
Projects
None yet
Development

No branches or pull requests

3 participants