- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to create a single DLL with both Fortran and C++ libraries linked into it. I need to have subroutines and C++ classes and methods available to the consumers of the DLL.
I understand from the documentation and this newsgroup that you cannot have C++ and Fortran source files in the same project, but believe you can achieve my goal by putting C++ in one project and Fortran in another lib project, then linking them into a single DLL. I cannot find documentation to support, and have failed in attempting this myself. Can someone provide a sample and/or give me some guidance in this area? I'm using Intel Fortran 9.X and Visual Studio 2005.
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is an example shipped with the compiler (at least since 10.0.something) that shows all combinations of X-calls-Y with static and DLL linkage. But is does not illustrate dllexport from a fortran .libproject through a C++ DLL project.
I haven't tried itbut it should just work. Can you provide an expanded discussion of "failed in attempting this"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a attempted to add an additional C++ basedlibrary to a previously all Fortran DLL (a DLL with several Fortran based libraries/projects linked into a single DLL). The compile and link of the mixed DLL (let's call it A) seems to be OK, but when I try to link another DLL (let's call it B) which depends on A and has references to both Fortran and C++ symbols in A, the C++ symbols are unresolved and B fails to link.
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include
"stdafx.h"#include
"CPPDLL.h"#include
#ifdef
_MANAGED#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call){
case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break;}
return TRUE;}
#ifdef
_MANAGED#pragma managed(pop)
#endif
// The following function is exported:
extern
"C" { CPPDLL_API double __stdcall ABC(){
DEMO () ; //calling the fortran export
}
Note:-add the fortran lib file to the this solution.
Also,
In the properties of this solution->Linker->Input->Additional Dependencies->specify the fortran lib file.
Your fortran dll can be like this:-
Subroutine
DEMO()!DEC$ ATTRIBUTES STDCALL,REFERENCE,ALIAS:"DEMO" :: DEMO
!body
End Subroutine
DEMO
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page