Hello, I have a C# GUI that is supposed to call a backend I have in a C++ CLI/CLR shared library. That library calls another DLL that was created by MATLAB, but I can't get the second DLL called...

Is it a mistake to put the backend in a DLL? How would I just have a C++ CLR "Program" that the frontend could access?

Can a managed C++/CLI library access another C++ DLL and there's some hoop I'm not jumping through?

Here is a sample of my code in case I didn't explain well enough:

C++ CLI Shared Library created in VS 2005:

#pragma once
#include "MATLABlib.h"


using namespace System;

namespace MATLABNamespace {

public ref class MATLABFunctionThreader
{

 public:
	 
 static int MATLABNamespace::MATLABFunctionThreader::setThreadPriority(String ^%tPriority,
															           HANDLE MATLABThreadHand);

 static int MATLABNamespace::MATLABFunctionThreader::setPriorityClass(String ^%pClass);

 static int MATLABNamespace::MATLABFunctionThreader::setProcessorMask(String ^%pAffinity,
																	  HANDLE MATLABThreadHand);

 static int MATLABNamespace::MATLABFunctionThreader::changeMATLABSeed(int inputSeed);

 static String^ MATLABNamespace::MATLABFunctionThreader::startProcessingThread(
                                                 String ^%threadPriority,
                                                 String ^%priorityClass,
                                                 String ^%processorAffinity);
 };
}

class MATLABDataWrapper
{

public:
 void MATLABDataWrapper::setValues(double dataSet[6])
 {
   this->mxInversions = dataSet[0];
   
   for(int i = 0 ; i <= 3 ; i++)
	   this->mxSample[i] = dataSet[i+1];

   this->mxTime = dataSet[5];
 }

 String^ MATLABDataWrapper::toString(void)
 {
   String ^outputString ="";

   outputString += this->mxInversions + "\n";
   
   for(int i = 0 ; i <= 3 ; i++)
   outputString += this->mxSample[i] + " ";

   outputString += "\n" + this->mxTime;

   return outputString;
 }

private:
 Double mxInversions;
 Double mxSample[4];
 Double mxTime;

};

class MATLABUnmanagedFunction{
public:
	static int initializeMCR(void);
	static int initializeMATLABLibrary(void);
	static MATLABDataWrapper runMATLABThread(void);
};

the MATLABUnmanagedFunction class stores all of the unmanaged functions I am trying to call from the wrapper file MATLABlib.h -- which is an automatically generated interface that is supposed to let me call a MATLAB DLL, but when I call initializeMATLABLibrary or any of the functions from the MATLAB DLL I get a System::IO::FileNotFound exception.

Is there a better way to have a C# frontend call my MATLAB C++ wrapper?

guess I should add that MATLABNamespace::MATLABFunctionThreader is a class that provides methods for my C# GUI to call... so the one that says startProcessingThread(...) is the one that uses methods from MATLABUnmanagedFunction, and creates a MATLABDataWrapper to hold output.

it returns

MATLABDataWrapper.toString(); which is my string formatted for my C# GUI's console.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.