- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
This is my first post in this forum and I'm pretty new at this visual studio stuff, if this is the wrong forum let me know which one it should be in.
I am a FORTRAN user who has a need to make calls and extract data from a C++ routine. I am not familiar with C++, nor am I very familiar with mixed language programming in general. The biggest stumbling block I have is trying to get the two codes to "see" and "like" each other if you will.
Here is what I'm using:
Intel Fortran 12 Compiler
Microsoft Visual Studio2008
I'm going to start out with baby steps first. Below is a Hello World C++ program
[bash]// test.h #define CALL __declspec(dllexport) namespace testfuncs{ class testfuncs extern "C" void CALL cwrite_ (); } // testfuncs.cpp #include "test.h" #includeThis seems to build okay and it creates a DLL named Cdll.dll.
First Problem ... There is no *.lib
I simply want to call this from a simple FORTRAN routine such as
program Forcall
implicit none
call write
end program Forcall
Any ideas?
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
By following the steps. I've always been successful to compile the cpp dll while when it comes to fortran main program, it keeps on telling me "error LNK2019: unresolved external symbol berechnung referenced in function MAIN__". Am I wrong in terms of linker setup? What should I do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using VS2012 (or maybe also VS2010), C DLL projects that are dependents of Fortran projects don't automatically get linked in. This is a Microsoft bug. The workaround is to add the DLL project's export library to the Fortran project directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve
Thank you very much for your help. I works now. I wonder do you know any tutorial talking about call a java dll from fortran main program? Thanks
Steve Lionel (Intel) wrote:
If you are using VS2012 (or maybe also VS2010), C DLL projects that are dependents of Fortran projects don't automatically get linked in. This is a Microsoft bug. The workaround is to add the DLL project's export library to the Fortran project directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't, but I would expect a DLL to be a DLL, really. All you should have to worry about is getting the routine name, calling convention and arguments correct. However, I'd also expect a Java DLL to not provide an export library, which means you probably have to use the LoadLibrary and GetProcAddress Windows API routines. We provide a DLL\DynamicLoad sample illustrating this.

- 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 »