- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I write a dll with fortran90.In the dll,I defined
a module to communicate and store data.The dll was called
by my VC++ application.But when I wanted to refer the data
in the module, Link error occured!!!
I followed the Help in the Online document,and the code
like this:
!in F90 file
MODULE EXAMP
REAL A(3)
INTEGER I1, I2
CHARACTER(80) LINE
TYPE MYDATA
SEQUENCE
INTEGER N
CHARACTER(30) INFO
END TYPE MYDATA
END MODULE EXAMP
!in my VC++ application
extern "C" float EXAMP_mp_A[3];
extern "C" int EXAMP_mp_I1, EXAMP_mp_I2;
extern "C" char EXAMP_mp_LINE[80];
extern "C" struct {
int N;
char INFO[30];
} EXAMP_mp_MYDATA;
when linking,Error 2001 occur.
error LNK2001: unresolved external symbol _EXAMP_mp_I1
error LNK2001: unresolved external symbol _EXAMP_mp_I2
error LNK2001: unresolved external symbol _EXAMP_mp_A
.......
Why???
and why we should refer the data like that "EXAMP_mp_A"?
I write a dll with fortran90.In the dll,I defined
a module to communicate and store data.The dll was called
by my VC++ application.But when I wanted to refer the data
in the module, Link error occured!!!
I followed the Help in the Online document,and the code
like this:
!in F90 file
MODULE EXAMP
REAL A(3)
INTEGER I1, I2
CHARACTER(80) LINE
TYPE MYDATA
SEQUENCE
INTEGER N
CHARACTER(30) INFO
END TYPE MYDATA
END MODULE EXAMP
!in my VC++ application
extern "C" float EXAMP_mp_A[3];
extern "C" int EXAMP_mp_I1, EXAMP_mp_I2;
extern "C" char EXAMP_mp_LINE[80];
extern "C" struct {
int N;
char INFO[30];
} EXAMP_mp_MYDATA;
when linking,Error 2001 occur.
error LNK2001: unresolved external symbol _EXAMP_mp_I1
error LNK2001: unresolved external symbol _EXAMP_mp_I2
error LNK2001: unresolved external symbol _EXAMP_mp_A
.......
Why???
and why we should refer the data like that "EXAMP_mp_A"?
Link Copied
0 Replies

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