Log in

View Full Version : What do the Swigtype classes do in the WPI, I have looked at the documentation


TheTurtleofDoom
05-02-2015, 16:18
http://first.wpi.edu/FRC/roborio/release/docs/java/classes.html is where I looked for the documentation, googling wpilibj swigtype had one result.Anyone know what they do?

nighterfighter
05-02-2015, 16:27
Did you try just searching "Swigtype"?

While I am not 100% sure, I believe Swigtype is referring to this:

http://www.swig.org/

Is there anything specific you are trying to do with them?

TheTurtleofDoom
05-02-2015, 16:40
Did you try just searching "Swigtype"?

While I am not 100% sure, I believe Swigtype is referring to this:

http://www.swig.org/

Is there anything specific you are trying to do with them?

No I didn't google that, and no I'm not trying to do anything with them, just saw the classes in the api and didn't know what they did, and couldn't find out anything about them.Thank you for this illuminating post.

baumgartensam
05-02-2015, 17:28
I just dove into the source and the header for all the files named SWIGTYPE_* is:/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */

Not sure what they are for but they are definitely associated with http://www.swig.org. The uses also seem very strange. Brad Miller will probably have a better explanation :)

UPDATE:
"SWIG is an interface compiler that connects programs written in C and C++ with scripting languages such as Perl, Python, Ruby, and Tcl." Maybe it has to do with the cross-compilation of wpilib?????

James Kuszmaul
05-02-2015, 18:11
In order to use certain HAL classes (written in C++) in the Java portion of WPILib, we create JNI bindings for those classes/functions. In the case of the new Talon SRX, we used swig to generate the JNI bindings for the CanTalonSRX class and then wrapped that with the CANTalon class. Those odd SWIGTYPE* classes are how swig handles c pointers in the JNI bindings. Teams should not need to use any of the swig-related classes; the CANTalon wrapper should implement all the necessary features.