vs2017 linux so导出函数,将Visual Studio 2017中的Assembly和C ++与命令行和输出相结合
我正在嘗試將這些語言結(jié)合起來用于測試目的。有沒有人知道為什么,在構(gòu)建項目后,當.asm文件在源文件夾中時,無法找到clear函數(shù)。下面顯示的以下圖像應(yīng)該解釋我的要求,我將進一步編輯。
.586 ;Target processor. Use instructions for Pentium class machines
.MODEL FLAT, C ;Use the flat memory model. Use C calling conventions
.STACK ;Define a stack segment of 1KB (Not required for this example)
.DATA ;Create a near data segment. Local variables are declared after
;this directive (Not required for this example)
.CODE ;Indicates the start of a code segment.
clear PROC
xor eax, eax
xor ebx, ebx
ret
clear ENDP
END
答案
如果跳過默認值,則需要創(chuàng)建自定義構(gòu)建步驟。右鍵單擊程序集源文件名,然后右鍵單擊屬性/自定義構(gòu)建步驟并輸入命令行和輸出字段:
用于調(diào)試版本:
command: ml /Zi /c /Fo$(outdir)example.obj example.asm
output: $(outdir)example.obj
發(fā)布版本:
command: ml /c /Fo$(outdir)example.obj example.asm
output: $(outdir)example.obj
您還可能需要在匯編源文件中將clear聲明為public:
public clear
對于64位構(gòu)建,請使用ml64而不是ml。
我通常通過創(chuàng)建一個“空項目”,然后添加現(xiàn)有項目(源文件)來啟動一個新項目,以避免由VS創(chuàng)建的默認內(nèi)容。
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的vs2017 linux so导出函数,将Visual Studio 2017中的Assembly和C ++与命令行和输出相结合的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 咋样路linux分区,linux下磁盘分
- 下一篇: linux web服务器系统优化,Ubu