[英]Undefined reference error when I try to call compiled NASM function from C program
I have ac program, to optimize this program I have tried this: 我有一个交流程序,为了优化该程序,我尝试了以下方法:
the original c method has this signature 原始的c方法具有此签名
float **my_method(int m, int n, float **MatrixA, float **VectorB){
//method boby
}
The problem: How to call the compiled optimized "NASMed" version of the method from C? 问题:如何从C调用方法的编译优化的“ NASMed”版本?
I have tried to declare this at the beginning of the c file 我试图在C文件的开头声明这一点
extern float **my_method(int m, int n, float **MatrixA, float **VectorB);
but when I try to call the method in c for example with 但是当我尝试使用例如在c中调用方法时
float **res= mymethod(rows, columns, matrix1, vect);
GCC returns me this error: Undefined reference to my_method GCC返回此错误: 未定义引用my_method
the compiled assembly file is named my_method.o
my c file is named my_program.c
编译后的程序集文件名为my_method.o
我的c文件名为my_program.c
I have tried to compile with gcc my_program.c
我试图用gcc my_program.c
进行编译
You might like to use something like 您可能想使用类似
gcc -Wall -Wextra -pedantic my_program.c -o my_program my_method.o
with my_method.o
being the result of the NASM compilation. 其中my_method.o
是NASM编译的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.