- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I went back to basics:
IVF code:
program fortran_c_test
implicit none
interface
subroutine c_code_test(index,foo)
!DEC$ ATTRIBUTES C, ALIAS:'_c_code_test' :: c_code_test
integer index
real(8) foo
end subroutine c_code_test
end interface
integer index
real(8) foo
index = 3
call c_code_test(index,foo)
write(*,*) foo
stop
end
MVS C++(C) code
#include
void c_code_test(index,foo)
int index;
double *foo;
{
*foo = 3.21 * index;
}
This is compiled and put into: C:mhoversfortran_c_testDebugc_code_dir.lib
In Project->Linker->Input->Additional Dependencies I have c_code_dir.lib
In Project->Linker->General->Additional Library Directories I have
C:mhoversfortran_c_testDebug
In Tools->Options->Intel Fortran->General->Libraries I have
C:mhoversfortran_c_testDebug
When I build fortran_c_test I get:
error LINK2019: unresolved external symbol _c_code_test referenced in function _MAIN__
Have I screwed up the INTERFACE or what?
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To answer my own question I have found that if I put
!DEC$ ATTRIBUTES NO_ARG_CHECK :: valIn the interface block in the fortran code I can pass the allocated memory and use it in the C code.
I am just not sure if this is a lucky guess or actually the correct thing to do?
thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
COMPLEX(8), DIMENSION(*) :: val
since val is an array. But you'll need to properly index the val array in the C code (your example does not use it.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying this from scratch again. I have my fortran project built, but when I right click on the executable, the popup does not have Project Dependencies and Project Build Order, as it does in my old project? What do I have to do to get access to "Dependencies"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good Morning!
Thank you for the posibility to write here my question!
I have a quite big source which is containes one c++ and one fortran project in one solution. Till this time i use Visual studio c++ 6 with compaq visual fortran6 and there was no any program with the link... the fortran part is dynamic linked.
But now,i would like to change to visual studio 2005 and intel fortran 10, buttill this time i had no success. The building of the two projectis running without any error message, but at linker i get the next message every time when a fortran routin is called from the c++ project:
Styps2000b.obj : error LNK2019: unresolved external symbol _STYP2000B@68 referenced in function "protected: void __thiscall CStyps2000b::OnOpti3Calc(void)" (?OnOpti3Calc@CStyps2000b@@IAEXXZ)
may I ask you to tell me if you have any idea how to solve this problem!
Thanks in advance for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just realized that I have to create the master project first, then when creating the projects that it will depend on it askes if the new project will be part of a new or existing solution, after clicking existing solution, it worked.
thanks,

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »