How to call a .dll?

12 views (last 30 days)
Kacper Gawinkowski
Kacper Gawinkowski on 20 Oct 2019
I made a simple dll file in c# with some funtions that should move the table.
Code fo the dll file looks like this:
namespace Table
{
public class TableAuto
{
IScan myscan; IStage myxyStage; IZ myz; IEncoders encoders; int port = 3;
double CurrentX, CurrentY;
public void MoveToAbsolute( int absoluteX, int absoluteY) %the method that i try to use
{
myscan = new Scan(); myxyStage = new Stage();
myscan.Connect(ref port);
myxyStage.MoveToAbsolute(absoluteX, absoluteY);
Thread.Sleep(1000);
myscan.DisConnect();
}
}
}
and code from matlab looks like this:
asm = NET.addAssembly('C:\Users\xactive\Desktop\tempProjects\Mikroskop\Table.dll');
Table.TableAuto.MoveToAbsolute(0,0); %i try to use the method here
I have no idea what im doing and how to operate on dll files. Things that i found on the internet are not understendable for me, thats why i try to get some help here.
Id be glad if you could tell me more less how to call a method from dll file in matalb code.
Thanks in advance.
  2 Comments
Kacper Gawinkowski
Kacper Gawinkowski on 20 Oct 2019
i think that loadlibrary() is for .h files wrote in C/C++ not for .NET library which im using

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!