Closed ycy1164656 closed 1 year ago
if swig support C# I'm sure it's possible, it'd be cool if you'd help us with that.
Ideally the C# high level abstraction layer should mimic the current high level abstraction classes we've created in Java, aside from all the automatic wrapping that swig does for us.
Apparently Swig does support C# https://www.swig.org/Doc3.0/CSharp.html#CSharp_introduction_swig2_compatibility
but I think there are some differences and we'll have to have a second libtorrent.c_sharp.i
if swig support C# I'm sure it's possible, it'd be cool if you'd help us with that.
Ideally the C# high level abstraction layer should mimic the current high level abstraction classes we've created in Java, aside from all the automatic wrapping that swig does for us.
Apparently Swig does support C# https://www.swig.org/Doc3.0/CSharp.html#CSharp_introduction_swig2_compatibility
but I think there are some differences and we'll have to have a second
libtorrent.c_sharp.i
I modified libtorrent.i file like this :
mainly modified
` %define TYPE_INTEGRAL_CONVERSION_EX(name, underlying_type, api_type, java_type) %typemap(ctype) name, const name& "java_type" %typemap(imtype) name, const name& "java_type" %typemap(cstype) name, const name& "java_type"
%typemap(in) name {
$1 = name(static_cast
then I copied libtorrent 1.2.18 include directory and boost to swig directory,
and I run swig -c++ -csharp libtorrent.i ,
but I got this error
boost\system\system_error.hpp(20) : Error: Syntax error in input(1)
do you have any idea what may cause this error?
by the way, I used swig 4.1
by the way, I used swig 4.1
ps. this error 'boost\system\system_error.hpp(20) : Error: Syntax error in input(1)' also occured when I run swig -c++ -java libtorrent.i(the origin libtorrent.i)
running swig on that file has certain requirements in environment variables carrying different paths.
Look at the build-xxx scripts in the swig directory
You should use swig 4.0.1, I just had it break by running the wrong version.
/usr/local/bin/swig -version
SWIG Version 4.0.1
4.0.2 works as well
just tested with swig 4.1.0 and it breaks. The libtorrent.i would probably need to be updated to make it work with 4.1.0, but that's not really our priority, make sure you have swig 4.0.2 and you should be able to move forward.
I've made it so that it works with swig 4.1.0
This was the issue.
On boost/system/system_error.hpp:20
class BOOST_SYMBOL_VISIBLE system_error: public std::runtime_error
swig couldn't recognize BOOST_SYMBOL_VISIBLE
👍🏻
I am making a wpf client ,and will use libtorrent,I'm wondering if it is possible to use your swig/libtorrent.i to create a c# version ? Thx .