Silverfrost Forums

Welcome to our forums

The questions about C++ to use ftn95 dll

27 Jul 2007 3:16 #2119

I want to use C++ to implement the user interface, and

implement the calculation part with Fortran.

I know I should make Fortran code to be DLL conceptually,but I

don't know what to do in practice.

What directives should I put in the Fortran code?

how to export my subroutine?

and how to call them from C++.NET?

I have installed this Fortran compiler, and it is already integrated in Visaul

Studio .NET 2003.

And can anyone tell me whether it is right?

subroutine demo(m,n,a) !DLLEXPORT !ASSEMBLY_INTERFACE (name = 'demo');

integer4 n; integer4 m; integer*4 a;

a = m + n;

return end subroutine

Thank you very much. ^^

27 Jul 2007 7:19 #2120

There is a section on this in FTN95.chm under Win32 Platform->Mixed language programming->Calling FTN95 from C/C++.

Your sample code contains comments that look a little like comment embedded directives. You can use comment embedded directives but they must begin with !FTN95$.

ASSEMBLY_INTERFACE is only for .NET.

27 Jul 2007 9:17 #2121

Thanks!

I have found that article, and it helps me a lot.

But may I ask you what is the difference between Win32 and .NET platform,

may I create dll on the .NET platform?

27 Jul 2007 12:28 #2122

Try typing 'What is .NET framework' into Google.

You can create a .NET dll but then you would probably use C# as a first choice or possibly 'managed' C++.

30 Jul 2007 7:03 #2125

Thank you very much!

I will try it.

Please login to reply.