Silverfrost Forums

Welcome to our forums

Calling a FTN95 DLL from C#

18 May 2010 10:41 #6382

I am using Visual Studio Express 2008 for C# and am trying to call a FTN95 DLL from C#.

The FTN95 help section “Net platform/.NET programming/Calling Fortran from other .NET languages” seems to say that such a DLL can be generated from command-line FTN95 using DBK_LINK2, with ASSEMBLY_INTERFACE inserted in each Fortran subroutine to be called.

Following the help’s example, I produced the simplest one-subroutine pi.dll file with an argument comprising one scalar integer and one scalar real*8 (int and double on the C# end). When I add this DLL to the C# project and call the subroutine from C# as shown in the help, I get the exception:

“Unable to load DLL 'pi.dll': The application has failed to start because its side-by-side configuration is incorrect.”

This also happens when running the C# project under the full Visual Studio Professional 2008. I am missing something critical. Any ideas? Thanks.

21 May 2010 5:58 #6400

Brian

What a horrible error message. Have you installed Visual Studio 2008 SP1? http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/62b42380-caf9-4a5c-8789-17c841382a25

21 May 2010 10:07 #6404

Hi Robert. Both my Visual Studio C# Express 2008 and my colleague's full Visual Studio 2008 have SP1.

25 May 2010 7:24 #6416

Everything I read on the subject suggests it is a problem with the Visual C++ redistribution set which is fixed in SP1 - and it seem a bit odd it affects both machines. Can you send your project to ftn95@silverfrost.com so we can at least test the compiler's output.

Please login to reply.