String returned from C# to Fortran - problem

anthonyrichards
Total Points:
4,222
Status Points:
3,722
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

8290 users have contributed to 31237 threads and 99114 posts to date.
In the past 24 hours, we have 8 new thread(s) 19 new posts(s), and 25 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to Pipeline buffer between stages? The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x