- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have problem with calling Fortran Dll from visual C++. The C++ and FORTRAN codes that I write are:
#include
#include
extern "C" __declspec(dllimport) void _stdcall DLL_ROUT (
int *INT_ARG,
char *STR_IN,
int STR_IN_LEN,
char *STR_OUT,
int STR_OUT_LEN);
void main (int argc, char *argv[])
{
char instring[40];
char outstring[40];
int intarg;
strcpy(instring,"Testing...");
intarg = 123;
DLL_ROUT(&intarg,instring,strlen(instring),outstring,40);
printf("%s\n",outstring);
}
SUBROUTINE DLL_ROUT (INT_ARG, STR_IN, STR_OUT)
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: DLL_ROUT
INTEGER INT_ARG
CHARACTER*(*) STR_IN, STR_OUT
CHARACTER*5 INT_STR
WRITE (INT_STR,'(I5.5)')INT_ARG
STR_OUT = STR_IN // INT_STR // CHAR(0)
RETURN
END
The error of program is such as this "error LNK2019: unresolved external symbol __imp__DLL_ROUT@20 referenced in function _main cmain.obj"
Sincerely yours
Behnam Rezaei
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have problem with calling Fortran Dll from visual C++. The C++ and FORTRAN codes that I write are:
#include
#include
extern "C" __declspec(dllimport) void _stdcall DLL_ROUT (
int *INT_ARG,
char *STR_IN,
int STR_IN_LEN,
char *STR_OUT,
int STR_OUT_LEN);
void main (int argc, char *argv[])
{
char instring[40];
char outstring[40];
int intarg;
strcpy(instring,"Testing...");
intarg = 123;
DLL_ROUT(&intarg,instring,strlen(instring),outstring,40);
printf("%sn",outstring);
}
SUBROUTINE DLL_ROUT (INT_ARG, STR_IN, STR_OUT)
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: DLL_ROUT
INTEGER INT_ARG
CHARACTER*(*) STR_IN, STR_OUT
CHARACTER*5 INT_STR
WRITE (INT_STR,'(I5.5)')INT_ARG
STR_OUT = STR_IN // INT_STR // CHAR(0)
RETURN
END
The error of program is such as this "error LNK2019: unresolved external symbol __imp__DLL_ROUT@20 referenced in function _main cmain.obj"
Sincerely yours
Behnam Rezaei
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it is possible for you put your source code in C++ and FORTRAN (that is run successfully) in this forum, please.
Thank you.
- 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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page