I am looking for a simple C# example implementing a typesafe interface to a complied MATLAB DLL using R2017b Compiler and VS2017
1 次查看(过去 30 天)
显示 更早的评论
I used the R2017b MATLAB compiler to build and install built AddMaster.DLL. No problems on this part.
function y = addOne(x)
y = x + 1;
end
Below is my (weak) attempt a a C# program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// using System.ServiceModel;
using AddMaster;
namespace LKTypeSafe
{
public interface IAddOne
{
int AddOne(int x);
}
class AddOneCls2 : IAddOne
{
public int AddOne(int x)
{
IAddOne obj = new AddMaster.addOne(int x);
int two = 0;
return two = obj.AddOne(x);
}
}
class AddMaster
{
static void Main(string[] args)
{
Console.WriteLine("Starting LKTypeSafe");
AddOneCls obj = null;
int input = 0;
try
{
// Instantiate your component class.
obj = new AddOneCls2();
// Invoke your component.
int output = obj.addOne(input);
// print the output.
Console.WriteLine(output);
Console.Write("\nPress any key to exit...");
Console.ReadKey(true);
}
catch
{
throw;
}
}
}
}
Step by step help on using VS2017 to build this simple example is requested. Any Help is appreciated.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Java Package Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!