Re: Trouble inlining code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

you might want to check:

http://www.greenend.org.uk/rjk/2003/03/inline.html

Esp. the part with the examples ... I think what you want is a static inline (not absolutely sure though)

Greets

-Sven

securehell@xxxxxxxxxxxx wrote:

-----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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux