How to use an overloaded function from a MATLAB compiled Dll in C# via P/Invoke ?
Ältere Kommentare anzeigen
I apologize if this is a rather simple problem, but my experience with C# is limited and I didn't find a similar question searching.
Assuming I have some MATLAB function myfun.m with various possible inputs, i.e. as an example [A,B]=myfun(N,M,O), [A,B]=myfun(N,M,O,P) and [A,B]=myfun(N,M,O,P,Q). I have used mcc (and in this case Visual Studio's compiler) to create a cshared library, let's just call it myfun.dll and now I want to use the function myfun in specific ways, [A,B]=myfun(N,M,O) and [A,B]=myfun(N,M,O,P).
I assume it's not enough to simply use DllImport and then define two separate functions, i.e.* :
[DllImport(...., Entry Point ="myfun")]
public static ... myfun1(numargout,[Out] A, [Out] B, [In] N, [In] M, [In] O);
[DllImport(...., Entry Point ="myfun")]
public static ... myfun2(numargout,[Out] A, [Out] B, [In] N, [In] M, [In] O, [In] P);
*Leaving out the data types, which I would assume those are not of particular importance to our problem and the usual stuff, such as myfunInitialize and myfunTerminate.
Sorry if this has been answered already, thanks in advance for all help.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu MATLAB Compiler finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!