- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How does one go about exporting overloaded, C-interoperable procedures from a DLL?
When programming in C, it's straightforward: just export each individual overloaded procedure. It's also straightforward when programming in Fortran for calling from the same Fortran program: use an interface block at the head of the module, viz:
...and so on. But what if I want to export these functions to a DLL, which will be loaded from a program written in C? I'd like the header file to look like:
... but how might I bring this about? At the moment I'm not quite sure where to start. Should the !DEC$ DELLEXPORT directives be placed in the procedures, in the interface block, or somewhere else? Is this even possible?
When programming in C, it's straightforward: just export each individual overloaded procedure. It's also straightforward when programming in Fortran for calling from the same Fortran program: use an interface block at the head of the module, viz:
[cpp]module gubbins interface foo module procedure sfoo, dfoo end interface contains subroutine sfoo(x, bar) real(kind(1e0)), intent(in) :: x real(kind(1e0)), intent(out) :: bar . . end subroutine sfoo subroutine dfoo(x, bar) real(kind(1d0)), intent(in) :: x real(kind(1d0)), intent(out) :: bar . . end subroutine sfoo end module gubbins[/cpp]
...and so on. But what if I want to export these functions to a DLL, which will be loaded from a program written in C? I'd like the header file to look like:
[cpp]void foo(float x, float bar); void foo(double x, double bar);[/cpp]
... but how might I bring this about? At the moment I'm not quite sure where to start. Should the !DEC$ DELLEXPORT directives be placed in the procedures, in the interface block, or somewhere else? Is this even possible?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The DLLEXPORT directives go in the procedures - always. Of course, C can't resolve the generic reference, so you'll have to call the specific procedure name from C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
The DLLEXPORT directives go in the procedures - always. Of course, C can't resolve the generic reference, so you'll have to call the specific procedure name from C.
Thanks Steve,
That's what I'd feared, but now I know,I can avoid wasting time trying to get around it!

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