Re: [CMake] SWIG CMAKE project not linked correctly

2017-09-15 Thread Bruce Jones
I'm not sure what is different between the CMake generated build and the
manual build, but according to the swig community definitions in the cpp
should be fine. I also couldn't find anything in the swig documentation to
suggest otherwise.

I did originally raise an issue on the swig github page:
https://github.com/swig/swig/issues/1091#issuecomment-329606916


On Fri, 15 Sep 2017 at 12:33 Hendrik Sattler <p...@hendrik-sattler.de>
wrote:

>
>
> Am 15. September 2017 15:23:42 MESZ schrieb Bruce Jones <
> bruce.david.jo...@gmail.com>:
> >Hi,
> >
> >I have a relatively simple SWIG - CMAKE project that is not linked
> >correctly, source files can be downloaded here:
> >https://drive.google.com/open?id=0B4Y0idbHnikgTUlocmQtNDY2czQ
> >
> >The problem I have is if the template function Foo is implemented in
> >the
> >header file, the project compiles and works successfully. If Foo is
> >instead
> >implemented in the cpp file, the project compiles but fails either when
> >linking on at runtime on Windows and Linux respectively.
>
> Templated member functions must be defined in the header. Exceptions are
> explicitly instantiated ones for certain template parameter values.
>
> >On windows the build will fail at linking with "unresolved external
> >symbols", as though the template function is not instantiated.
> >
> >On Linux python fails to import the module with "undefined symbol".
> >
> >If I build the projects by hand (not with CMake) they compile and link
> >successfully, and run successfully.
>
> Strange. it should not work because the method definition in the cpp file
> will not result in any symbol due to unknown type T. So what are you doing
> differently? Some commands must differ.
>
> HS
>
> --
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> gesendet.
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] SWIG CMAKE project not linked correctly

2017-09-15 Thread Bruce Jones
Hi,

I have a relatively simple SWIG - CMAKE project that is not linked
correctly, source files can be downloaded here:
https://drive.google.com/open?id=0B4Y0idbHnikgTUlocmQtNDY2czQ

The problem I have is if the template function Foo is implemented in the
header file, the project compiles and works successfully. If Foo is instead
implemented in the cpp file, the project compiles but fails either when
linking on at runtime on Windows and Linux respectively.

On windows the build will fail at linking with "unresolved external
symbols", as though the template function is not instantiated.

On Linux python fails to import the module with "undefined symbol".

If I build the projects by hand (not with CMake) they compile and link
successfully, and run successfully.

Any suggestions?

Cheers,
Bruce
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake