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

Importing module from a DLL

rvitor2004
Beginner
919 Views
I'm trying to import a subroutine from a modulecontained in a DLL but it's appearing the error:
Error 1 error #6633: The type of the actual argument differs from the type of the dummy argument.
I already check the argument and it's the same type that is espected.
What could be?
0 Kudos
5 Replies
Steven_L_Intel1
Employee
919 Views
It is very likely that the compiler is correct that the types do not match. Without seeing the sources, that's the best I can tell you. I will comment that the subroutine is in a DLL is not important - I assume you have a USE to name a module that in the DLL, so the compiler looks for a .mod file by that name. It might be that if the compiler is not seeing the correct .mod file - it looks in the same place as for INCLUDE files - then you might get unexpected issues.
0 Kudos
mecej4
Honored Contributor III
919 Views
There are some combinations of attributes for which actual subprogram arguments may reasonably be expected to be identical to the type of the dummy argument, but are not considered so by the Fortran compiler.

Please show the declarations of the actual arguments and the dummy arguments of the subprogram whose invocation gave you the error.
0 Kudos
rvitor2004
Beginner
919 Views
the declarations:
character(len=10) function InstSP(Ocelula)
type (CCelula), intent (inout) :: Ocelula
Real*8 :: hl
hl = getHfEq(Ocelula)
...
end functionInstSP
the function getHfEq that's in the DLL:
Real*8 Function getHfEq (Ocelula)
!DEC$ ATTRIBUTES DLLEXPORT :: getHfEq
type (CCelula), intent (inout) :: Ocelula
...
end function getHfEq
and the type CCelula:
type CCelula
private
integer :: id
type(CBolha) :: OBolha
type(CPistao) :: OPistao
type(CFilme) :: OFilme
type(CAdmin) :: OAdmin
type(CTrecho), pointer :: OTrecho
real*8 UM
end type
the error it's associated with this type. I don't know what's going on
0 Kudos
mecej4
Honored Contributor III
919 Views
The pieces of code that you show do not tell much. It is not even clear which piece belongs to which subprogram source.

You wrote about a 'subroutine', but it appears that it is a function in the DLL that is being used. Where is the type and interface declaration for the function used in

hl = getHfEq(Ocelula)

That information cannot match the DLLExport directive, since here we are talking about a DLL Import.

Not enough information, context quite unclear. Sorry.
0 Kudos
Lorri_M_Intel
Employee
919 Views
One possibility is that you are not using the *SAME* declaration of type CCelula

Just because the name is the same, or the set of fields is the same, does not make the type "the same", if you have the declaration in two different places. You need more.

Per the Fortran standard, "Two data entities have the same type if they are declared with reference to the same derived-type definition. Data entities also have the same type if they are declared with reference to different derived-type definitions that specify the same type name, all have the SEQUENCE attribute or all have the BIND attibute, have no components with PRIVATE accessiblity, and have type parameters and components that agree in order, name, and attributes. Otherwise, they are of different derived types."

-- Lorri
0 Kudos
Reply