Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

dllexport from a module

tum
Beginner
860 Views
I work with CVF 6.6.A and it is the first time that I deal with DLLs

I am trying to access data in a module associated with dll.

module abc
real a
!DEC$ ATTRIBUTES DLLEXPORT :: a
end module

The dll was built successfully. Subroutines are accessible.
My check with dumpbin /exports show ABC_mp_A in the list

When I link the dll to the main code and try to access the data in the module via USE statement, I have
main.obj : error LNK2001: unresolved external symbol _ABC_mp_A

Can somebody give me an idea what is wrong?

Thanks

at

0 Kudos
5 Replies
Steven_L_Intel1
Employee
860 Views
Download and install the free 6.6B update - it fixes this problem. If the problem persists, send details to vf-support@compaq.com

Steve
0 Kudos
tum
Beginner
860 Views
Thanks, Steve.

Although the update did not help, I understood from your message that I was not wrong in understanding of the concept. I have sent the samples to the support team.

Thanks again

at
0 Kudos
Steven_L_Intel1
Employee
860 Views
I would guess that you did not link the executable against the export library (.lib) generated when the DLL was linked. This is required.

Steve
0 Kudos
tum
Beginner
860 Views
Thanks, Steve, for your suggestions

I have the link to .lib (via project-add to project-file). I can see/use subroutines from the dll. If I close reference to the parameter "a", the exe-file is generated and I can refer to a subroutine. If a reference to the parameter "a" appears in the main code, the link gives error.

I work with samples before touching my real programs.

The dll sample is
________________________
module abc
real a
!DEC$ ATTRIBUTES DLLEXPORT :: a
end module abc

SUBROUTINE test(xx)
!DEC$ ATTRIBUTES DLLEXPORT :: test
REAL XX
print*,xx
a=99.
RETURN
END SUBROUTINE
_______________________

The main code:
-----------------------
PROGRAM maintest
use abc
implicit none
REAL XX
XX=5.
call test(xx)
print*,a
END PROGRAM maintest

-------------------------
If I delete the reference to a in the main code, everything is OK

I appreciate your comments

AT
0 Kudos
tum
Beginner
860 Views
It works. I had to copy also .mod file into the executable project
0 Kudos
Reply