Silverfrost Forums

Welcome to our forums

importing Intel Visual Fortran .dll Procedures

12 Dec 2011 4:53 #9366

Hello, I am currently mixing ftn95 and ifort projects in visual studio 2010 but am encountering difficulties.

My silverfrost program calls a dll subroutine with no arguments:

program ftn95_prog

   stdcall intelSimple 'intelSimple'

   call intelSimple() ! Call a simple intel fortran function (no args)   

   write(*,*) 'hit return to terminate...'

end program ftn95_prog

My Intel .dll is composed of 3 external functions:

subroutine intelSimple()   
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, DECORATE,ALIAS:'intelSimple' :: intelSimple   

   interface  
      subroutine subA()
      end subroutine subA   
   end interface       

   write(*,*) 'simple intel subroutine called'
   call subA() 

end subroutine intelSimple


subroutine subA()   
!subroutine for calling 'subB' with an array argument  
    integer,dimension(3,3) :: array      
    interface
       subroutine subB(array)   
          integer,intent(inout),dimension(:,:) :: array
       end subroutine subB   
    end interface

    array=1
    call subB(array)   
end subroutine subA   


subroutine subB(array) 
   integer,intent(inout),dimension(:,:) :: array     
   array=2  
end subroutine subB

When running this program I expect an array argument with shape = (3,3) to be passed into 'subB', instead I find it has shape = (19241...,1,1,0)

Everything apears fine until I step into subroutine subB.

I would appreciate any help whatsoever Thanks

13 Dec 2011 12:29 #9369

Additionally, it would appreciate it if anybody could explain the difference between stdcall and f_stdcall. Does this just determine where hidden length arguments will appear?

Cheers

Please login to reply.