Undefined reference error when I try to call compiled NASM function from C program

AndreaF

I have a c program, to optimize this program I have tried this:

  1. compile the most heavy method (named my_method) separately
  2. disassembly the compiled method
  3. editing the assembly code generated from the compiler to optimize this
  4. compile edited and optimized assembly code with NASM compiler

the original c method has this signature

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?

I have tried to declare this at the beginning of the c file

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

float **res= mymethod(rows, columns, matrix1, vect);

GCC returns me this error: Undefined reference to my_method

the compiled assembly file is named my_method.o my c file is named my_program.c

I have tried to compile with gcc my_program.c

alk

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Compiled C program with call to undefined/undeclared function; no error or warning reported. Why?

C program compiled file with clang leads to zsh: segmentation fault error when i try to change the assembly code

why i get "no attirubute error" when i try to call python function from c++

undefined reference to opencv function when i compiled with Makefile

Error occurs when I try to call an inherited function in C++

Undefined reference to function in C program

Error: use of deleted function when I try to use a reference

GCC error undefined reference to function but function is defined, implemented, compiled

Getting a C error that I have an undefined reference to function, but the function is defined

I've got the error message when try to call API function

undefined reference to function error in c

Undefined json data when i try to call it

Undefined reference to C Macro, but gets redefined error when I define it

undefined reference to c function when calling from go code

Why am I getting an 'undefined' when I try to call my function?

'this' is undefined when I call a function from my service

undefined reference to function call

C++: Undefined function error when I have defined the function

I get stray '#' in program error when I try to compile this program

How can I call a module function inside Enum.map without getting an "Undefined reference" error?

Can anyone tell me why my program crashes when I try to call the Insert or Delete function in a menu driven array manipulation program?

How can I fix the "undefined reference to" error in cpp, when call for functions in rigidbodytree, like doKinematics, CreateKinematicCache

Why do I get an error message of NoneType object is not callable when I try to call this function?

Can anyone tell me why I get a error when i try to call this function?

AttributeError: undefined symbol when importing own c compiled function in python

C compiler error: undefined reference to function

Why does it give an error when I call a function as a call by reference with a variable value that has no value?

Why do I get 'undefined' error when I try to read session atrribute from Controller

Why do I get an error (Notice: Undefined index) when I try to echo a value from my database?