- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have received a fortran file from a client. I need to create a dll file for that fortran file and move it to my current working folder.
My analysis software( completely different engineering analysis software) will read that file.
Now today I installed Visual studio 2017 and complete Intel parallel studio XE 2018 evaluation version.
1) I have two questions. How do i convert this fortran file to dll file ? Can it be done in the Visual studio software ?
If I have to do it in the Visal Studio Shell, please give me the commands for that.
2) I am trying to open a new fortran project type in Visual studio. But there is no such type displayed. How do i do this ?
Please explain it in simple terms. I am not a software guy.
Thanks a lot.
Regards
AK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to know what routines are to be exported by the DLL that are to be used by your engineering analysis software, the calling convention to be used, and the processor architecture on which the DLL is to be run.
Rather than cope with the complications of setting up Visual Studio, projects, and so on, you can build a DLL at an Intel Fortran command window with the command
ifort /dll <myfile.f90> /Fe<dll_name>
where <myfile.f90> is the name of the file that your client gave you, and <dll_name> is the name of the DLL that your analysis software wants to load and use.
Another alternative would be to ask your client to build and send you the DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to what mecej4 says, any subroutines or functions in the source that you want to call in the DLL must have an ATTRIBUTES DLLEXPORT directive in each one. For example:
subroutine somesub (argument) !DEC$ ATTRIBUTES DLLEXPORT :: somesub ...
Please be aware that your use of the Fortran compiler under the evaluation license is restricted to evaluating the compiler and the use of anything compiled with it is usable "only for the term of the evaluation." Read the license agreement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have such problem
!DEC$ if defined(_dll)
subrountine XX
!DEC$ else
program XX
!DEC$ ENDIF
But i have a syntax error writing such sequence
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you really write "subrountine" instead of "subroutine"? Please show us the actual code and the actual error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@mecej4, I am getting this error messages when i use that command
@Steve, If I can successfully link this dll to my analysis software and simulate the flow, I can ask my manager to buy a full version, as we have the actual projects analysis in line.
I cannot see this command in the client sent fortran file. !DEC$ ATTRIBUTES DLLEXPORT :: somesub
But he is successsfully doing this task of fortran to dll conversion and run the simulations. Could it be because of the version problem ? I am using latest XE studio and Visual studio 2017 installed. But client informed me he is using 'Visual Fortran Composer XE 2011 Update 12' and 'Visual Studio* 2010 Shell' to create the dll file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to first compile the sources that define the various modules. In this case it might make more sense to use Visual Studio as it will handle the dependencies.
- In Visual Studio, select File > New > New Fortran Project from Existing Code...
- In the dialog that opens, fill in the path where you want the project created and the project name. Click Add and browse to the folder containing the source files for the DLL. Click Next
- On the next screen, change the Project Type to Dynamic DLL. If you want a 64-bit DLL, check the x64 box. Click Finish
You will now have a project with the source files to create a DLL. But you will need to edit the sources to add the DLLEXPORT directives as I described above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve for replying.
As I mentioned in my first post, I cannot see any Fortran project types to create in visual studio. I installed the complete package of Visual Studio . My current version is Version 15.5.3 Professional 2017.
Picture link. While i select project from existing code, I see only these 3 options. NO fortran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should have no blanks between "/Fe" and "test.dll".
There are several ways of specifying the exported symbols from a DLL. One is to use directives in the source code. A second way, if you need to export just one or two names, is to use a /export:<exported_name> in the linker options. A third way is to use a module definition (*.DEF) file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's not the "wizard" I suggested you use. It's this one:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I also have a Fortran subroutine that I would like to create a dll from. So far I have followed the discussion given in this very page but I end up with errors such as
Error Compilation Aborted (code 1)
Severity Code Description Project File Line Suppression State
Error error #5082: Syntax error, found IDENTIFIER 'ATTRIBUTES' when expecting one of: => = . [ % ( :
......
Error Compilation Aborted (code 1)
Error Severe: No such file or directory
Can someone please provide a working example, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have a syntax error in your code (that you have not shown us.) Nothing in this thread is relevant to your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have successfully compiled the project using intel visual fortran 2019 compiler in both 64 bit and 32bit bit configuration in windows 10. The DLL file (rxns.dll) created is not being run by the GMS (ground water modelling system) version 10.4 64bit. How can I be able to run DLL file in GMS/RT3D?
Attached is the error message from GMS/RT3D.
Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's a rather generic message and not too helpful. Does the application run if you don't supply your DLL? I am not familiar with GMS/RT3D but usually applications that let users add DLLs do so with dynamic loading.
I suggest you first ask for help from GMS/RT3S support. We know nothing about your DLL or what is being asked of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
target environment : Visual Studio x64 wth DLL in OFFICE 365 x64 bits
- Is it possible to call ,from a program a DLL in OFFICE365 cto explain ant do test this ?
- is there specific parameters for compiling / linking ?
- Have you a single DLL sample , for instance an addition X+Y, to explain this ?
With my thanks for your help and/or advice ?
O.B.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Omar, your question really belongs in a new thread.
1. Yes, though your use of "OFFICE365" is too generic. Which part of Office are you interested in? There is a complete example of calling a Fortran DLL from Excel in the Intel Parallel Studio XE for Windows Sample Bundle (under compiler_f\MixedLanguage). You'll want to be sure to build the DLL for x64.
2.For x64, nothing more than what a DLL normally needs. Keep in mind that the compiler will upcase the routine name.
3. See above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve for the time spent for helping.
Best regards
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page