This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Trouble inlining code


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello group,

I am trying to inline a function with gcc-3.4.4 on a linux x86_64
platform.

The function I am trying to inline is in a header file:

foo.h:

inline int *your_func(int *a) { if (!a) return (NULL); return
(*a++);}

Any file that I compile that includes this header and code compiles
without error:

gcc -m64 -c -Wall -Winline -fPIC -O3 -o bar.o bar.c

But when I try to link, I get a mess...

/usr/bin/gcc -shared -Wl,--whole-archive -Wall -Winline -fPIC -o
libfiles.so file.o libfoo.a -Wl,--no-whole-archive

libfoo.a(file.o)(.text+0x0): In function `my_func':
: multiple definition of `your_func'
libfoo.a(bar.o)(.text+0x0): first defined here

What could I be missing that will inline this function for me?

Thanks,

SH
-----BEGIN PGP SIGNATURE-----
Note: This signature can be verified at https://www.hushtools.com/verify
Version: Hush 2.4

wkYEARECAAYFAkPs/8EACgkQRBFe1uc9INoi7gCaAkhb9S5rcYWmyEwmvK34mILqH1UA
oJmf9uXEUpXxMYmIYoil2WrYz246
=wiWt
-----END PGP SIGNATURE-----



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]