I created a dll library in FASM and now i want to use it in my C project but i get error when i want to open the executable file (which generated by C (GCC))
FASM dll code:
FORMAT PE64 CONSOLE DLL
ENTRY _entry
include 'EXPORT.INC'
section '.code' code readable executable
_entry:
mov eax, 1
ret
func:
mov eax, 5
ret
section '.edata' export data readable
export 'libs.dll', func, 'func'
section '.reloc' fixups data readable discardable
C (CMake):
cmake_minimum_required(VERSION 3.15)
project(untitled6 C)
set(CMAKE_C_STANDARD 11)
add_executable(untitled6 main.c)
target_link_libraries(untitled6 "D:\\untitled6\\libs.dll")
C Code:
int
main() {
int i;
asm volatile ("call\tfunc" : "=a"(i));
return i;
}
when i try to open the executable file, i get this error:
D:\untitled6\libs.dll is either not designed to run on Windows or contains an error .... Error status 0xc000007b
both executable and DLL are for 64-BIT ... but i really don't know what is the problem !!!
User contributions licensed under CC BY-SA 3.0