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

DLLEXPORT and CALL

Rudy__Delcroit
Beginner
337 Views

Hello expert,

A silly question, my fortran project is a Windows DLL. It exports a function called 'polyfit'. Calling the function from excel works fine. However, when I want to call this function from my own DLL .. I'm not even able to compile. Error is 'unresolved external symbol'.

I guess I'm not allowed to call from my own DLL a function which is exported. Then how should I do it ?

The export code is the following :

!MS$IF DEFINED (_DLL)
!MS$ATTRIBUTES DLL EXPORT :: polyfit
!MS$ATTRIBUTES STDCALL,ALIAS:'polyfit' :: polyfit
      .... arguments ....
!MS$ENDIF

The calling code from inside fortran is simply :

CALL POLYFIT( ....)

Thanks,

Vincent

0 Kudos
1 Reply
IanH
Honored Contributor II
337 Views

Your calling code needs to know the attributes of the thing that it is calling - particularly that it has the STDCALL attribute and [perhaps] that you've set an alias for the name of the procedure.  If the procedure is in a module (?), then the USE of the module provides this, otherwise you need an interface block.

0 Kudos
Reply