- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to make a small program that uses a static library made in FORTRAN&C, to see how the calls work from Fortran to functions made in C when I want work whit Build Environment for IA-32 applications, the source of the program it's described next, if I use the Fortran command prompt, I am able to do it, but if I want do it from Microsoft IDE to develop, I obtain the next error:
Console1 error LNK2019: unresolved external symbol _WRITE_HELLO referenced in function _WRITE_SM()
The first step that I have make is a Project where I've made the library. In this work area there are two projects, one for the fortran files and and another one for the C files. I have configured of following form the PROPERTY PAGES:
FORTRAN/EXTERNAL PROCEDURES:
Calling COnvention-->Default
FORTRAN/LIBRARIES
Disable Default Library Search Rules--> No
The second step to do is the link the lib to the main program.
I've did "Add existing item-->prog.lib"
FORTRAN/EXTERNAL PROCEDURES:
Calling COnvention-->Default
FORTRAN/LIBRARIES:
Disable Default Library Search Rules--> No
Result-->error LNK2019
If I change the next property:
LINK/INPUT:
Additional Dependecies-->prog.lib
Result-->
Console1 Fatal error cannot open "libra.lib"
Console1 error: problem during multi-file optimization compilation (code 1)
what is it wrong in the Properties?
LIBRARY Code:Lib_c_64.h #include#include #include #include #include int write_hello();
Prog_c_64.c #include "Lib_c_64.h" int write_hello() { printf("Ciaooooooo"); return 0; }
Prog.f90 SUBROUTINE WRITE_SM() INTERFACE INTEGER FUNCTION WRITE_HELLO() !DEC$ ALIAS:'_write_hello'::write_hello END FUNCTION END INTERFACE INTEGER IO IO = write_hello() RETURN END SUBROUTINE WRITE_SM
Thanks in advance
Cesar
Link Copied
0 Replies

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