Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java bindings are broken #6

Open
jgvictores opened this issue Feb 19, 2018 · 3 comments
Open

Java bindings are broken #6

jgvictores opened this issue Feb 19, 2018 · 3 comments

Comments

@jgvictores
Copy link
Member

Inspiration: https://github.com/roboticslab-uc3m/asibot-main/tree/d640e9962ef62765f7354612cfcb88ed5cb3ca25/bindings

@PeterBowman PeterBowman self-assigned this Feb 19, 2018
@PeterBowman
Copy link
Member

I started the fix-6-java-bindings branch and made some uncommitted progress, but this is beyond my SWIG skills. Python bindings are far easier to create since it's a dynamically typed language. A statically, strongly typed one as Java requires some knowledge about the JNI wrappers around the remote library, that is, YARP. In other words, I can't compile viewIRobotManager(yarp::dev::PolyDriver&) because of the public dependency on yarp::dev::PolyDriver.

This is how it looks like in asrob_yarp_devices.java (generated by SWIG):

package asrob_yarp_devices;

public class asrob_yarp_devices {
  public static IRobotManager viewIRobotManager(PolyDriver d) {
    long cPtr = asrob_yarp_devicesJNI.viewIRobotManager(PolyDriver.getCPtr(d));
    return (cPtr == 0) ? null : new IRobotManager(cPtr, false);
  }
}

Even if I smuggle a import yarp.PolyDriver somehow, there is no yarp.PolyDriver.getCPtr method anywhere, which means that SWIG is not aware of the intrinsics of YARP's bindings and how to treat them.

A few links I gathered while messing with this:

@jgvictores
Copy link
Member Author

jgvictores commented Feb 20, 2018

A q&d solution I've done in the past was essentially creating a duplicate of yarp.i (e.g. removing parts and changing module name), but including the new header. Not sure... perhaps the world has seen worse practices...

@PeterBowman
Copy link
Member

Java example app (currently broken) at 306e108.

@PeterBowman PeterBowman removed their assignment Feb 23, 2018
@jgvictores jgvictores added the bug label Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants