- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am using Intel Visual studio 2010 to compile a program that we develop in my lab. There are both C (for embedding, lecture of licence file, parsing of data files, etc.) and Fortran (for computation part) subroutines. The main program is written in C and calls a fortran subroutine which manages the computation.
I compiled this code with CVF before, and have converted the dsw file with IVF as specified.
I choose C as the main program, and the fortran subroutines make thus a library.
Everything is almost fine while compiling, but at link, I obtain the classical :
error LNK2019: unresolved external symbol _simple referenced in function _main
The main function is mainly:
main (argc,argv)
int argc;
char **argv;
{ ...
simple();}
while the simple subroutine (fortran one) begins with:
subroutine simple
!#ifdef WIN32
!MS$ATTRIBUTES C,ALIAS:'_simple' :: simple
!#endif
I understand that in some way, the main does not find the simple subroutine. I asked Intel support about this, and I was advised to use !DEC$ATTRIBUTES C,ALIAS:'_simple' :: simple in the fortran subroutine. This was working fine for support, but when I use this, the problem remains. I suppose thus that there is also smthing in the project.
I have drstically simplified the program with the original CVF project to keep the problem. I can provide you with it if you will.
Thank you in advance,
Dr. B. Dussoubs
I am using Intel Visual studio 2010 to compile a program that we develop in my lab. There are both C (for embedding, lecture of licence file, parsing of data files, etc.) and Fortran (for computation part) subroutines. The main program is written in C and calls a fortran subroutine which manages the computation.
I compiled this code with CVF before, and have converted the dsw file with IVF as specified.
I choose C as the main program, and the fortran subroutines make thus a library.
Everything is almost fine while compiling, but at link, I obtain the classical :
error LNK2019: unresolved external symbol _simple referenced in function _main
The main function is mainly:
main (argc,argv)
int argc;
char **argv;
{ ...
simple();}
while the simple subroutine (fortran one) begins with:
subroutine simple
!#ifdef WIN32
!MS$ATTRIBUTES C,ALIAS:'_simple' :: simple
!#endif
I understand that in some way, the main does not find the simple subroutine. I asked Intel support about this, and I was advised to use !DEC$ATTRIBUTES C,ALIAS:'_simple' :: simple in the fortran subroutine. This was working fine for support, but when I use this, the problem remains. I suppose thus that there is also smthing in the project.
I have drstically simplified the program with the original CVF project to keep the problem. I can provide you with it if you will.
Thank you in advance,
Dr. B. Dussoubs
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If your library is A DLL, you must EXPORT the symbol _simple (lower case).
Otherwise, if it is a static library, use DUMPBIN on the library to get a list of symbols and see what the symbol is for the 'simple' routine.
Remember also that IVF uses a different default calling (and naming) convention than CVF.
Otherwise, if it is a static library, use DUMPBIN on the library to get a list of symbols and see what the symbol is for the 'simple' routine.
Remember also that IVF uses a different default calling (and naming) convention than CVF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The exclamation marks in these lines
Please clarify. I doubt that the device that you are trying to control will work with 32-bit instructions as well as 64 bit instructions (unless it contains an X64 processor itself!).
[fortran]!#ifdef WIN32 !MS$ATTRIBUTES C,ALIAS:'_simple' :: simple !#endif [/fortran]suggest that the person who put them in was trying to coerce the name decoration to work even when WIN32 was not set. If so, you are compiling for WIN64, and the name decoration conventions for C and Fortran are not the same as for WIN32.
Please clarify. I doubt that the device that you are trying to control will work with 32-bit instructions as well as 64 bit instructions (unless it contains an X64 processor itself!).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bernard,
More information on the differences between CVF and Intel Visual Fortran here. Also you might check the documentation on DLLs and Mixed Language programming to flesh out some of the suggestions made here about the cause or even take a look at the Mixed Language Programming sample for ideas on how to implment this in Intel Visual Fortran.
It is installed by default on your system at: C:\Program Files (x86)\Intel\Composer XE 2011 SP1\Samples\en_US\Fortran\Mixed_Language.zip
Wendy
More information on the differences between CVF and Intel Visual Fortran here. Also you might check the documentation on DLLs and Mixed Language programming to flesh out some of the suggestions made here about the cause or even take a look at the Mixed Language Programming sample for ideas on how to implment this in Intel Visual Fortran.
It is installed by default on your system at: C:\Program Files (x86)\Intel\Composer XE 2011 SP1\Samples\en_US\Fortran\Mixed_Language.zip
Wendy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you everybody for your advices.
In fact, the problem comes (quite logically) from the fact that the fortran library must be added as an additional dependency in the Linker/Input section of the properties for the C++ project.
I do not think (I may be wrong) that this is explicitely precised in the white paper describing CVF to IVF project migration. I think that, whatever obvious (not enough for me I am affraid), this could be added. Unless this does not apply systematically ?
Best Regards,
Dr. B. Dussoubs
In fact, the problem comes (quite logically) from the fact that the fortran library must be added as an additional dependency in the Linker/Input section of the properties for the C++ project.
I do not think (I may be wrong) that this is explicitely precised in the white paper describing CVF to IVF project migration. I think that, whatever obvious (not enough for me I am affraid), this could be added. Unless this does not apply systematically ?
Best Regards,
Dr. B. Dussoubs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, if you create MYDLL.DLL and EXPORT symbols from it, then the list and location of the exported symbols will be created in file MYDLL.LIB at the same time. That is the file that must be included in any project that needs to link to the DLL in order to supply the required external reference symbols for the main program.
If you examine the Linker...Input Aditional dependencies entry in a project's property pages, you will see whole load of .LIB files listed. You could add MYDLL.LIB there, if you want, but the file would have to be located in a folder that is included in the list of folders in the PATH environment variable that the linker will follow to try and locate the file. Best just to add it to the project.
If you examine the Linker...Input Aditional dependencies entry in a project's property pages, you will see whole load of .LIB files listed. You could add MYDLL.LIB there, if you want, but the file would have to be located in a folder that is included in the list of folders in the PATH environment variable that the linker will follow to try and locate the file. Best just to add it to the project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the suggestion. I have forwarded it on to Steve Lionel the author of the migration paper.
------
Wendy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This really has little to do with CVF migration and everything to do with VS2010. You would encounter the same problem migrating a pre-VS2010 mixed-language application to VS2010. This is covered in the Intel Fortran release notes and in the Configuring Visual Studio for Mixed-Language Applications article. But I can see that the "Extract Compaq Visual Fortran project items" wizard needs to be adjusted to take into account VC2010's refusal to deal with project dependencies.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page