Problem with creating shared library with SWIG GO and C++ wrapper containing callbacks (windows)
Rachmat Hartono <[email protected]> Tue, 8 Jun 2021 16:24:18 -0700
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CAMoFrcMo_NX2bZj2c1DTnmMDQ_E0w36zTGgnOihPTw8_bFwV4w@mail.gmail.com> |
Does anyone ever had any issues when creating shared library (.dll), in the
following scenario: SWIG go, C++ wrapper, and callback functions in C++? I
noticed that the C++ wrapper generated by SWIG go will use extern “C” for
the callbacks, eg:
.cxx:
extern “C” void Swiggo_DeleteDirector_Callback_5b45909afdbe1105(intgo);
.go:
//export Swiggo_DeleteDirector_Callback_5b45909afdbe1105func
Swiggo_DeleteDirector_Callback_5b45909afdbe1105(c int) {
swigDirectorLookup(c).(*_swig_DirectorCallback).SwigcptrCallback = 0
swigDirectorDelete(c)
}
The above will cause ‘undefined references/symbols’ error when I tried to
call: gcc -shared file_wrap.cxx libfile.dll
Im using MingW64 in Windows.
My understanding is that SWIG Go is meant to link statically as it uses
extern "C" when generating the cxx wrapper containing the callback
functions. Is it possible to generate a shared library with SWIG go and cxx
wrapper containing callback function?
Note: the above problem is specific to windows, as linux and mac can
generate the sharedlibs (.so, .dylib) with callback functions successfully.
Thanks much...
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user