Community

MotionController::ErrorLogCountGet() returns garbage

[RMP 8.0.7]

I’m trying to test something in a production version of our software using an older version of RSI.
It’s crashing.

I tried to create a simplistic test just to prove that I wasn’t crazy. I may still be crazy.

I can start RapidSetup and start the network.

My C++ app crashes. There’s probably a failure in MotionController::CreateFromSoftware(), but I can’t figure out what it is. My test app tries to ErrorLogCountGet(), and it returns an unreasonably large number (in excess of a billion). My (real) app’s code compares this result to zero and then tries to ErrorLogGet(), which returns 0x4 (rather than a meaningful RsiError*). This is consistently (i.e. always) crashing.

My test app crashes, too, as soon as I try to do much of anything (e.g. VersionGet()).
I have RSI defined in the environment. I also have it added to the PATH.

Here’s the output I get:

Controller: 0x25f1308
Errors: 1737401608
Serial #: 7
Version: crash

RapidSetup doesn’t complain about the license, though I have no other way to verify that it’s good or bad.

I can’t get any error messages from the RSI lib code because that mechanism is hosed. Can you give me any advice for how to figure out what’s wrong?

Here’s my test app.

#include <iostream>
#include <string>
#include <iomanip>

#define RSIAPP
#include "rsi.h"

void test() {
	  RSI::RapidCode::MotionController  *controller;
 
      try
      {
		  controller = RSI::RapidCode::MotionController::CreateFromSoftware();
		  std::cout << "Controller: " << "0x" << std::hex << (int)(void*)(controller) << std::dec << "\n";
		  std::cout.flush();
		  auto errors = controller->ErrorLogCountGet();
		  std::cout << "Errors: " << errors << "\n";
		  std::cout.flush();
		  std::cout << "Serial #: " << controller->SerialNumberGet() << "\n";
		  std::cout.flush();
		  std::cout << "Version: " << controller->VersionGet() << "\n";
		  std::cout.flush();
	  }
	  catch ( const std::exception& e ) {
		  std::cout << "Exception: " << e.what() << "\n";
	  }

	  std::cout << "finished\n";
}


void main() {
	try {
		test();
	}
	catch ( const std::exception& e ) {
		std::cout << "Exception from test(): " << e.what() << "\n";
	}
	std::cout << "test() finished\n";
}

*facepalm*

So, it turns out I didn’t put the new RSI dir high enough in the PATH. There was another RSI dir there (for a different version).

We pass in the path to the RSI version on the CreateFromSoftware("…") call which takes the PATH out of the equation.

PATH comes into play when the executable is loaded and Windows attempts to resolve runtime dependencies, before it ever runs the exe. I believe it loads RSIQVC.dll from the PATH (if it’s not in the CWD), and if there are binary incompatibilities, then prepare for unpredictability.

We copy the DLLs to the same folder as our EXE. We should probably add a check that the reported RSI version matches the version we are going to pass into the CreateFromSoftware call

Windows leaves a lot to be desired in terms of binary dependencies. )-8

Yes, they have never fully addressed DLL Hell…