Run Fortran DLL with Visual Studio

后端 未结 3 736
孤城傲影
孤城傲影 2020-12-10 23:45

I develop a website with Visual Studio 2010. I want to run a Fortran DLL. I used Intel Visual Fortran to create a .dll and to test how to use it. My code is:



        
3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 23:53

    I do this all the time. What I do, is in the calling project (C#, VB.NET) I add the .dll output to the project as an existing item, with Add as Link option. Then I set it to copy if newer in the project tree.

    Add Item

    Add As Link

    Copy If Newer

    In the end it follows the binary when you compile it into the bin/Debug or bin/Release folders.

    With C# you then use the [DllImport()] attrbiute like this:

    [DllImport("trex_pc.dll")]
    static extern Simpson(ref int N, ref int H, ref int I);
    

    For more details look at this answer from me.

提交回复
热议问题