Reputation: 11
I have a little problem while compiling an Eclipse project. I have a file that needs to call functions present in an already compiled files (.o files).
Init.c
#include Init.h
void Init() {
InitA();
InitB();
InitC();
InitD();
}
Init.h
extern void InitA();
extern void InitB();
extern void InitC();
extern void InitD();
void Init();
And the 4 functions are present in the object file motor_init.o
I would like to know if it is possible to call these functions and how.
Upvotes: 1
Views: 3527
Reputation: 2220
Yes, that's what .o
files ar for, containing function. You have already defined the signatures, so all you'll need to do is is create init.o
and link them together into your final product.
if you're using gcc as compiler:
gcc -c init.c
gcc init.o motor_init.o -o output
Sorry i don't know specifics about eclipse plugins.
Also, if you have it, i would recommend using motor_init.h
.
Upvotes: 3