- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi!
The question is easy, how can I create a dll library from several fortran files?
Javier
- Balises:
- Intel® Fortran Compiler
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The answer is equally easy: in the same way you would a standalone program.
If you use Visual Studio, define a project with the required output type. If you use the command-line, then:
ifort /dll name1.obj name2.obj name3.obj ... /exe:dllname.dll
(assuming you have already compiled the individual source files)
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
OK Thanks,
But reading the documentation say that I should have to files. One is the dll file and the second is a lib file in order to use to link when I have to do a program.
The previous procedure create the dll file, but where is the lib file?
Thanks again
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The .lib is created in the same place as the DLL. If you don't see it, then you're missing !DEC$ ATTRIBUTES DLLEXPORT directives for any routines you want exported from the DLL.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hello
When I do a static library, I need only the mod and smod files and the lib file to create a new program. I don't need worry about which routines I'm using in the program.
Now, I'm trying to do the same but using dll. I don't understand when you say that I need !DEC$ ATTRIBUTES DLLEXPORT if I want to export any routines from DLL. From your comment, I have to add !..... (macro) in every procedure (subroutine or function)? inclusive if I use modules or submodules?
Javier
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You need to add an ATTRIBUTES DLLEXPORT directive in each and every subroutine and function you want visible outside the DLL. It goes in the actual routine, not interfaces. For example:
subroutine foobar (arg1, arg2) !DEC$ ATTRIBUTES DLLEXPORT :: foobar ...
You're right that this is different from creating a static library. When using it, it's the same - link to the .lib. (Of course, you then have to make sure the DLL is in a location Windows will find it.)
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Only the subroutines and functions (optionally data) that are required to be called from the users of your DLL require the !DEC$ ATTRIBUTES DLLEXPORT ... The DLL private procedures need not have the DLLEXPORT.
Jim Dempsey
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
OK
My last question. All my procedures (functions or subroutines) are into a modules (or submodules). For each modules I have private and public procedures and variables.
If I understand well, I need to put in each public variables and public procedures the directive !DEC$ ATTRIBUTES....., right?
Is not possible to write all directives in one zone of the module file?
and I have seen also !DIR$ ATTRIBUTES DLL..... what is the difference respect to !DEC$ ATTRIBUTES DLL....?
Thanks for your help.
Javier
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You cannot put these in the module interface - they must go in the actual procedure. When you put a DLLEXPORT into a module procedure, it turns into a DLLIMPORT when the module is USEd.
There is no difference between !DEC$ and !DIR$. Either prefix works.
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable