您的位置:首页 > 博客中心 > 网络系统 >

asm play - clion ubuntu

时间:2022-04-03 16:24

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(Test)
enable_language(ASM_NASM)

set(CMAKE_C_STANDARD 99)

set(ASM_SOURCES
     test.asm
)

set (SOURCES
     main.c 
     ${ASM_SOURCES}
)

set_source_files_properties(${ASM_SOURCES} PROPERTIES LANGUAGE ASM_NASM)

add_executable(program  ${SOURCES})

main.c

#include <stdio.h>

extern long test(long);

int main()
{
    printf("%ld", test(5));
    printf("Hello, World!\n");
    return 0;
}

test.asm

section text

global test

test:
    mov rax, 111
    ret

ref: stackoverflow

本类排行

今日推荐

热门手游