Static linking into swig wrapper
<p>I have a working swig wrapper for C++ library(mylib.so). And now I want to link mylib.so to the wrapper library(mylib_wrapper.so) statically. Currently I build my wrapper with cmake.   </p>

<ol>
<li>Should a wrapped library be a static library(not a dynamic) if I want
have a static linking in my swig wrapper?</li>
<li>What modifications I should do in my interface/cmake files?</li>
</ol>

<p>Currently I have following cmake file:</p>

<pre><code>cmake_minimum_required(VERSION 2.8)

find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(Ruby)
include_directories(${RUBY_INCLUDE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_SWIG_FLAGS "")
set(MODULE_NAME ruby_module)
set(CMAKE_SWIG_OUTDIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

set_source_files_properties(${MODULE_NAME}.i PROPERTIES CPLUSPLUS ON)

swig_add_module(${MODULE_NAME} ruby ${MODULE_NAME}.i ruby_wrapper.cpp)
swig_link_libraries(${MODULE_NAME} ${MAIN_LIBRARY_NAME})
swig_link_libraries(${MODULE_NAME} ${RUBY_LIBRARIES})
</code></pre>

<p>And .i file:</p>

<pre><code>%module ruby_module

%{
#include "ruby_wrapper.h"
%}

%import std_string.i

%include "ruby_module.h"
</code></pre>

<p>And headers file:
<strong>ruby_module.h and ruby_wrapper.h</strong> are have the same content.</p>

<pre><code>#include &lt;string&gt;

class MyClass
{
public:
  MyClass();
  ~MyClass();

public:
  std::string myfunc(const std::string&amp; path);
};
</code></pre>

<p>In the ruby_wrapper.cpp file is overwrited functions of mylib.so .</p>