String returned from C# to Fortran - problem

anthonyrichards
Total Points:
4,302
Status Points:
3,802
Brown Belt
November 27, 2008 6:08 AM PST
Rate
 
#8 Reply to #7
Quoting - pieterj
Ops, and now this file :o) 

I do not know C#, but I do know that if you want a Fortran program to call a function in a DLL, then

a) you must make the function or symbol for the function visible to users of the DLL, and
b) In your Fortran code, you must use the correct symbol for the function you wish to access in the DLL, possibly using a compiler flag such as ALIAS, and
c) In your Fortran code, you must mark that symbol as to be IMPORTED from a dll using a compiler flag such as DLLIMPORT,
d) You must also, in your Fortran, ensure that the calling convention agrees with the C# one (e.g. are the arguments supplied by value or reference (i.e. address)

In your C# code,

using System;
using System.Windows.Forms;

namespace prijimac
{
	public class Class1
	{

		public static void ShowNumber(int a, int b)
		{
			MessageBox.Show("a=" + a.ToString()+ " b=" + b.ToString());
		}

	}
}

There are no symbols exported, correct?. Thus, as far as I can see from your zipped archive, there is no export library (.LIB) of symbols generated and supplied along with your C# DLL, so there is no way for your Fortran program to be given the details as to what and where are the symbols that you wish to reference in your Fortran code (normally you would include the .LIB in your Fortran project to do this). This shortcoming has to be rectified first before you stand a chance of calling functions in your DLL, IMO.



Intel Software Network Forums Statistics

8470 users have contributed to 31601 threads and 100646 posts to date.
In the past 24 hours, we have 30 new thread(s) 113 new posts(s), and 159 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member kopernikus