I have a function defined in a .c file (say funcs.c ):
void *funName() {
and compiled into a library ( libname.so ).
And I compile another .c file ( main.c ) that uses this function, and I set the character names on the command line:
gcc -Wl,
symbolsfile.txt
FunSym = funName,
Symbol2 = expression2;
...
but I get this communication error:
symbolfile.txt: 1: unsolvable character 'funName' specified in expression
symbolfile.txt: 2: unsolvable symbol 'expression2' specified in the expression
collect2.exe: error: ld returned 1 exit status
I tried adding a function declaration to funcs.c (I don't have a corresponding .h file), but that didn't change anything.
If I change FunSym = funName to FunSym = garbage , the error changes to "undefined symbol ...", so I think the expression funName found.
Update:
I tried adding extern void *funName(); at the top of main.c or in a separate header file, as suggested in the comments, but this did not solve the problem (same error). Do I need to add the --just-symbols flag when compiling main.c or when compiling / linking the library ( libname.so )?
source share