jasonlarkin / p3dfft

Automatically exported from code.google.com/p/p3dfft
GNU General Public License v3.0
0 stars 0 forks source link

Multilpe C symbols from functions in p3dfft.h #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A user reports: 

I ran into a small hiccup with P3DFFT that I wanted to report so it
can be fixed for the next release.

The p3dfft.h header declares and implements methods like get_dims,
p3dfft_ftran_r2c, etc.  If a user includes p3dfft.h in foo.c and
compiles it to get foo.o, and then includes p3dfft.h in bar.c and
compiles it to get bar.o, then trying to link both foo.o and bar.o
gives multiple copies of the P3DFFT C symbols.  The linker dies.
That's because the p3dfft.h declares function bodies for get_dims,
p3dfft_setup, etc.

One easy fix is to stick 'inline' in front of each of the get_dims,
p3dfft_setup, etc functions in p3dfft.h.  That, however, requires the
compiler to support the inline keyword.  Most C compilers do, though
it's not in older C standards.

Another fix would be to compile the C wrapper functions from p3dfft.h
and link them into the p3dfft static library.  That adds a little
messing around to the build system.

-----
What is the expected output? What do you see instead?

Let's go with inline and test on several platforms/compilers. 

Original issue reported on code.google.com by dmitry...@gmail.com on 17 Apr 2010 at 2:02

GoogleCodeExporter commented 9 years ago
Made changed, works on CentOS platform. Will need to test on other platforms and
compilers.

Original comment by dan.djc...@gmail.com on 30 Apr 2010 at 1:21

GoogleCodeExporter commented 9 years ago

Original comment by dan.djc...@gmail.com on 30 Apr 2010 at 1:23