DLLEXPORT and CALL

DLLEXPORT and CALL

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

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today