Click here to Skip to main content
11,803,561 members (66,788 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# DLL Matlab
I have prepared a simple matlab code and deployed it by means of deployment procedure in matlab in ".Net assembly" type (for use in 2010). The output Dll file of matlab was named "main". But that error occurs. I have added references.
What I really want is to define variables and give values to them in C# environment, calculate the outputs in Matlab Dll file, and finally show the results in C#.

Matlab Code:
function c=main(a,b)
C# code:
namespace WindowsFormsApplication1
public partial class form1.form
public static extern int main (int a, int b);
public form1()
private void button1_click(object sender, EventArgs e)
int a,b,c;
Posted 7-Oct-12 0:43am
Edited 7-Oct-12 2:00am
Wes Aday at 7-Oct-12 6:51am
First thing: Do not post your email. It's an invitation to spammers. Second thing: public static extern int (int a, int b); is wrong.
Hadi Farahani at 7-Oct-12 7:53am
You are OK. I forgot it. I have added "main" to that line of code.
Richard MacCutchan at 7-Oct-12 7:47am
Third thing, don't call a library function main(), as it will conflict with any main method in your application or the framework.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


That article will helps you:

1..2..3 ways of integrating MATLAB with the .NET[^]


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 375
1 CPallini 290
2 F-ES Sitecore 270
3 Sergey Alexandrovich Kryukov 234
4 CHill60 220
0 OriginalGriff 3,000
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,755
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100