- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Please show the declarations of the actual arguments and the dummy arguments of the subprogram whose invocation gave you the error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page