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

DEC attributes to create DLL for vb.net and excel

kirbychapman
Beginner
578 Views
I have a Fortran DLL project that I am building in IVF11.1. The DLL has entry points that i would like to call from VB.net (VS2008) and also from Excel VBA macros. To find the entry points, i included in the following two lines in each fionction/subroutine that i call from vb.net/excel:

!dec$ attributes dllexport :: MW_fnc
!dec$ attributes stdcall, REFERENCE, alias :'MW_F' :: MW_FNC

The name of the function, in this case, is real(8) Function MW_fnc.

This allows me to then DECLARE the function MW_F in VB.net and in Excel VBA.

The problem is this -- the source code is split up into a few different files. The MW_FNC routine is contained in FILEA.f. There is a second routine (SABS_F) that makes use of this function, but it is in FileB.f. WhenI compile/link the code, i get the error:
Error 11 error LNK2019: unresolved external symbol _MW_FNC referenced in function SABS_F. entropy.obj

I also end up with warnings that are something like this for other functions that do not have the second DEC statement (i.e., they are not aliased):
Warning 5 warning : locally defined symbol __imp__DENSITYSITOIP_FNC imported Release\h_air.obj
Warning 10 warning LNK4217: locally defined symbol _DENSITYSITOIP_FNC imported in function _GETDENSITYFORFLOWRATE_FNC h_air.obj

I am pretty sure this all has to do with the DLLEXPORT, STDCALL, and ALIAS attributes, but i am at a loggerhead. Can someone help me?

Kirby
0 Kudos
1 Solution
Steven_L_Intel1
Employee
578 Views

You must repeat the ATTRIBUTES line with STDCALL and ALIAS in any routine that wants to call the exported routine. The warnings are harmless and can be ignored.

View solution in original post

0 Kudos
2 Replies
Steven_L_Intel1
Employee
579 Views

You must repeat the ATTRIBUTES line with STDCALL and ALIAS in any routine that wants to call the exported routine. The warnings are harmless and can be ignored.
0 Kudos
DavidWhite
Valued Contributor II
578 Views

You must repeat the ATTRIBUTES line with STDCALL and ALIAS in any routine that wants to call the exported routine. The warnings are harmless and can be ignored.

This previous thread in the forum may give you the answer you need

David
0 Kudos
Reply