- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I am working on a project where I have 4 fortran files: A.f90 is the main subroutine in which I have the line
!DEC$ ATTRIBUTES DLLEXPORT::A
and where I call the 3 others modules (let's call them B_mod.f90 C_mod.f90 and D_mod.f90 ).
To compile them on windows (I want a .dll output file), I do:
>ifort /c B_mod.f90 C_mod.f90 D_mod.f90
and :
ifort /dll A.f90 B_mod.obj C_mod.obj D_mod.obj /link libai_analogy.lib libai_saber.lib /NODEFAULTLIB:LIBCMT.lib
That works well and I get my A.dll output file (~231ko), and works properly later when it is called by another program on windows.
Now I would like to do the same on linux (debian 9), so I do:
>ifort -c A.f90 B_mod.f90 C_mod.f90 D_mod.f90
>ifort -shared -o A.dll A.o B_mod.o C_mod.o D_mod.o -Xlinker libai_analogy.lib libai_saber.lib
At first sight, it compiles without any error message, however the output dll file is this time ~452ko, and is not working when I call him later.
Could you please tell me where I am doing something wrong, and how can I proceed properly with linux?
Thanks a lot for your help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shared libraries on linux are of file type .so
For help see: https://www.thegeekstuff.com/2012/06/linux-shared-libraries/
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may also need to specify -fpic because many versions of Unix require that objects being linked into a shared library contain only position-independent code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim,
ok so "libai_analogy.so" instead of "libai_analogy.lib" for instance.
But what if I don't have the ".so" files ? (I only have .lib files because they are coming from a windows software). Can I do something ?
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't use Windows-compiled code on Linux. You'll have to rebuild the libraries from sources (or get them in a Linux-targeted form that works with Intel Fortran.)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page