Closed colthreepv closed 9 years ago
Pretty simple (well, sort of), for instance:
switch alert.Xtype() {
case libtorrent.Metadata_received_alertAlert_type:
metadataAlert := libtorrent.SwigcptrMetadata_received_alert(alert.Swigcptr())
Oh wow, yes!
Reading your example I traced it back to SWIG documentation.
Too bad it wasn't so clear before you pointed it out, thanks a ton.
Remember SWIG lets you interact with interfaces, that's why you need the actual SWIG type (Swigcptr
prefixed) to properly convert the pointer.
I am trying to cast a specific alert to its C++ subclass, to access its methods. I also opened a stackoverflow question since my desperation got to very high levels :scream:
I have read the source code of torrent2http, and has been a real source of informations, but you never cast an Alert there, I was wondering if you know how to do an
alert_cast
or something similar in Golang.Thanks for your time