- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bit of a newbie question on F90 as I've not really worked with interface blocks before.
I can't seem to export a routine that has an interface specification to it. Example (cut down from the original problem) is:
module foo
interface fred
module procedure bar
end interface
...
contains
subroutine bar
!dec$attributes dllexport,alias:'myname'::bar
...
end subroutine bar
end module
This will compile ok but will not export the symbol 'myname'. However, if the interface block is removed, then it will export it. Nothing seems to work by putting the dllexport attribute in the interface block either.
The only way it will work is if I have a separate glue routine that does not have an interface specified, & which calls the required routine.
Is there any neater way around this?
Regards,
FSM
I can't seem to export a routine that has an interface specification to it. Example (cut down from the original problem) is:
module foo
interface fred
module procedure bar
end interface
...
contains
subroutine bar
!dec$attributes dllexport,alias:'myname'::bar
...
end subroutine bar
end module
This will compile ok but will not export the symbol 'myname'. However, if the interface block is removed, then it will export it. Nothing seems to work by putting the dllexport attribute in the interface block either.
The only way it will work is if I have a separate glue routine that does not have an interface specified, & which calls the required routine.
Is there any neater way around this?
Regards,
FSM
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sounds like compiler bug to me. Steve?
Few workarounds to try:
1) Create a .DEF file with the following contents & just insert it into your project:
2) What happens if you dllexport fred instead of bar?
Jugoslav
Few workarounds to try:
1) Create a .DEF file with the following contents & just insert it into your project:
EXPORTS myname=_FOO_mp_BAR@0where FOO is module name (uppercase), _mp_ is lowercase, BAR routine name, and @n stands for 4* number of arguments of BAR (every CHARACTER(*)argument, if any, counts as two).
2) What happens if you dllexport fred instead of bar?
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know this works in the current compiler, as I've done it. I'm not sure if it works in 6.6B. What version is being used here?
Exporting bar is correct, but the use of the alias here may cause trouble for users of module foo (I haven't tried this part).
Of course, this is now outside of "F90", which has no concept of "dllexport".
Steve
Exporting bar is correct, but the use of the alias here may cause trouble for users of module foo (I haven't tried this part).
Of course, this is now outside of "F90", which has no concept of "dllexport".
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was just working on a dll project on 6.6B, so I performed a quick test and I can confirm it doesn't work. Linking is all OK, but no export is produced if there's an interface.
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok - I guess that's a bug we fixed post-6.6B.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using 6.6B.
Is there any possibility of getting the bug fixed version?
Is there any possibility of getting the bug fixed version?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav wrote:
2) What happens if you dllexport fred instead of bar?
The compiler doesn't allow a DLLEXPORT attribut to be attached anywhere in the interface block & merely complains that the line is wrongly positioned.
regards,
FSM
2) What happens if you dllexport fred instead of bar?
The compiler doesn't allow a DLLEXPORT attribut to be attached anywhere in the interface block & merely complains that the line is wrongly positioned.
regards,
FSM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yep, I tried that myself. But I've also verified that approach with .DEF file does work.
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> I've also verified that approach with .DEF file does work.
>
> Jugoslav
Yes. I've been dllexporting from within interfaces for years now without any problem because I always create a .def for the dll exports.
Ciao,
Gerry T.
>
> Jugoslav
Yes. I've been dllexporting from within interfaces for years now without any problem because I always create a .def for the dll exports.
Ciao,
Gerry T.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even with .def entry for clearfp, the following doesn't link because clearfp is unresolved:
interface
integer(4) function clearfp() ![C,ALIAS:'__clearfp'] ()
!DEC$ ATTRIBUTES DLLEXPORT, C, ALIAS:'__clearfp':: clearfp
end function clearfp
end interface
If I eliminate !DEC$ and the comment in the function statement, it links but doesn't export. How do I fix this?
Thank you,
Gerry T.
interface
integer(4) function clearfp() ![C,ALIAS:'__clearfp'] ()
!DEC$ ATTRIBUTES DLLEXPORT, C, ALIAS:'__clearfp':: clearfp
end function clearfp
end interface
If I eliminate !DEC$ and the comment in the function statement, it links but doesn't export. How do I fix this?
Thank you,
Gerry T.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For anyone who might be interested, with a .def entry for _clearfp, the following allows clearfp to be referenced within Fortran code and for it to be exported as _clearfp:
interface
integer(4) function clearfp()[DLLEXPORT, C, ALIAS:'__clearfp']()
end function clearfp
end interface
It's all much ado about using a single (_), a double (__), or no underscore really and exporting from an interface block without the !DEC$ metacommand (but I'm sure it's lurking somewhere.)
HTH,
Gerry T.
interface
integer(4) function clearfp()[DLLEXPORT, C, ALIAS:'__clearfp']()
end function clearfp
end interface
It's all much ado about using a single (_), a double (__), or no underscore really and exporting from an interface block without the !DEC$ metacommand (but I'm sure it's lurking somewhere.)
HTH,
Gerry T.

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