Skip to content

Commit

Permalink
Merge pull request #120 from Intermodalics/fix/loading_shared_library…
Browse files Browse the repository at this point in the history
…_coconut

fix/loading_shared_library_coconut
  • Loading branch information
Perrine Aguiar committed Jan 24, 2017
2 parents ea94ec4 + a554753 commit 0a8ac1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ protected void init(NodeMainExecutor nodeMainExecutor) {
// Create and start Tango ROS Node
nodeConfiguration.setNodeName(TangoRosNode.NODE_NAME);
if (TangoInitializationHelper.loadTangoSharedLibrary() !=
TangoInitializationHelper.ARCH_ERROR) {
TangoInitializationHelper.ARCH_ERROR &&
TangoInitializationHelper.loadTangoRosNodeSharedLibrary()
!= TangoInitializationHelper.ARCH_ERROR) {
mTangoRosNode = new TangoRosNode();
mTangoRosNode.attachCallbackListener(this);
TangoInitializationHelper.bindTangoService(this, mTangoServiceConnection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ public class TangoInitializationHelper {
protected static boolean mIsTangoServiceBound;
protected static boolean mIsTangoVersionOk;

/**
* {@link TangoInitializationHelper} depends on the same library as {@link TangoRosNode}.
* This code is added to ensure that the native functions will be properly linked;
* loading the same library twice has no side effects.
*/
static {
try {
System.loadLibrary(TangoRosNode.DEFAULT_LIB_NAME);
} catch (Exception e) {
Log.e(TangoInitializationHelper.class.getName(),
"Error loading library " + TangoRosNode.DEFAULT_LIB_NAME, e);
}
}

/**
* Binds to the tango service.
*
Expand Down Expand Up @@ -185,6 +171,23 @@ public static final int loadTangoSharedLibrary() {
return loadedSoId;
}

/**
* {@link TangoInitializationHelper} depends on the same library as {@link TangoRosNode}.
* This code is added to ensure that the native functions will be properly linked;
* loading the same library twice has no side effects.
*/
public static final int loadTangoRosNodeSharedLibrary() {
int loadedSo = ARCH_ERROR;
try {
System.loadLibrary(TangoRosNode.DEFAULT_LIB_NAME);
loadedSo = ARCH_DEFAULT;
} catch (Exception e) {
Log.e(TangoInitializationHelper.class.getName(),
"Error loading library " + TangoRosNode.DEFAULT_LIB_NAME, e);
}
return loadedSo;
}

/**
* Creates a DefaultTangoServiceConnection with no callback.
* @return New ServiceConnection handler that can be used with {@link #bindTangoService}
Expand Down

0 comments on commit 0a8ac1e

Please sign in to comment.