I get an error message as follows:
error LNK2019: unresolved external symbol _ONOWNERDRAW referenced in function _newdlgproc
Here is the relevant code extract:
INTEGER*4 FUNCTION NewDlgProc(hWnd, mesg, wParam, lParam)
!DEC$ATTRIBUTES STDCALL:: NewDlgProc
INTEGER*4 hWnd, mesg,lParam, wParam
!DEC$ ATTRIBUTES, STDCALL : : OnOwnerDraw
integer(HANDLE) :: hWnd, hDC
integer(DWORD) :: ID
CALL OnOwnerDraw(getdlgItem(hWnd,IDC_OWNER),IDC_OWNER, Itemstruc%Hdc)
In the source file with
CALL OnOwnerDraw( .....)
You need the INTERFACE copied or included somehow. each source file with calls to OnOwnerDraw needs to know it's STDCALL, otherwise you'll get the wrong ABI for the call and the link step will fail. Names for STDCALL procedures are decorated differently.
Easiest to put OnOwnerDraw into a MODULE and USE the module where you call OnOwnerDraw
To elaborate: if the call is in a subroutine or function:
you need to put the interface inside subroutine FOO. It does not 'inherit' it from the source file above by magic.