- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I build dynamic library with vs2008 like this
extern "C" _declspec(dllexport) void _stdcall ADD_d(int*,int*);
void _stdcall ADD_d(int*A,int*B)
{
B=A+10;
}
then call this function in the fortran like this
!DEC$ ATTRIBUTES DLLIMPORT :: ADD
integer A,B
A=10
call ADD_d(A,B)
but linked using intel fortran, error occur ike this
_ADD_D cannot resovled
can anyone tell me how to fix the problem?
extern "C" _declspec(dllexport) void _stdcall ADD_d(int*,int*);
void _stdcall ADD_d(int*A,int*B)
{
B=A+10;
}
then call this function in the fortran like this
!DEC$ ATTRIBUTES DLLIMPORT :: ADD
integer A,B
A=10
call ADD_d(A,B)
but linked using intel fortran, error occur ike this
_ADD_D cannot resovled
can anyone tell me how to fix the problem?
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suggest you look at the mixed language section of the documentation - you probably need to use STDCALL in the Fortran DLL declarations. Also, you need to look at what symbols the DLL is exporting (suggest you use dependency walker from dependencywalker.com). You may need an Alias to correctly decorate the name expected by Fortran - both case and the underscores are significant.
David
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
anyone can give me more obvious answer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check this thread in the forum http://software.intel.com/en-us/forums/showthread.php?t=61587&o=a&s=lr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Follow David's advice and (read the documentation then) add the STDCALL and ALIAS attributes (and fix the subroutine name typo?). To do this you'll also need an interface block.
Is there a reason that you are using STDCALL? If not, then consider using the Fortran 2003 C interoperability feature of Intel Fortran.
[fortran]INTERFACE SUBROUTINE ADD_d(a, b) ! Be mindful of line length in fixed form !DEC$ ATTRIBUTES DLLIMPORT, STDCALL, DECORATE, ALIAS:'ADD_d' :: ADD_d IMPLICIT NONE INTEGER :: a, b END SUBROUTINE ADD_d END INTERFACE [/fortran]
Is there a reason that you are using STDCALL? If not, then consider using the Fortran 2003 C interoperability feature of Intel Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The actual routine is called ADD_d, but your dllimport statement refers to ADD.
Regards,
Arjen
Regards,
Arjen
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