- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In starting to migrate from cvf to IF, I want to compile a dll which is called by a cvf com-server.
Is this even possible?
for ref here is the full cl string for compiling the dll:
df.exe /check:bounds /arch:host /nologo /warn:all /traceback /dll /libs:dll source.f90 /link /stack:0x5,0x5 >dfout.txt 2>&1
Thanks, Tim
Is this even possible?
for ref here is the full cl string for compiling the dll:
df.exe /check:bounds /arch:host /nologo /warn:all /traceback /dll /libs:dll source.f90 /link /stack:0x5,0x5 >dfout.txt 2>&1
Thanks, Tim
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes - in general, as long as you get the calling interface right, you can call ANY DLL, no matter what created it.
I will comment that your use of /stack when linking a DLL does nothing - that is useful only when linking an EXE.
Steve
I will comment that your use of /stack when linking a DLL does nothing - that is useful only when linking an EXE.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the info and the pointer Steve,
Before I get immersed into a goose chase for finding literal equivalents in IF, maybe you
can give a few hints to save a lot of time.
I have a com server which calls a dll written by a 3rd party.
The 3rd party wants to switch to IF but I want to keep the com server on CVF.
The dll looks like:
--------------------------
module mydll
real(8),save:: realVar
real(8),allocatable,save:: realArr
etc...
contains
pure real(4) function mydll_somefunc(args)
!DEC$ ATTRIBUTES DLLEXPORT:: somefunc
end function
....
end moddule
------------
The CVF com server calls this dll which is to be built w/ IF.
The only way I have figured out to do this in cvf was to write an interfacing module with lines like
-------------
module UserFunctionInterface
interface
pure real(4) function mydll_somefunc(args)
!dec$ attributes dllimport,decorate, alias: "MYDLL_mp_MYDLL_SOMEFUNC" :: mydll_somefunc
real(4),intent(in):: args
end function mydll_somefunc
etc...
end module
-------------------------
The interface module is part of the com server project. This scheme works and was the only way
you could recommend doing it a long time ago.
side comment: I wished that the dll could have been used as a simple module so that
I did not have to set its variables by passing in dummy vars/arrays only to copy them into the
module vars. But that is besides the point here.
-------------------------
I have previously given the compile c.l. args I use for the cvf compiler.
Now the question is what advice can you give in porting this scheme over so that the dll can
be written for IF?
Before I get immersed into a goose chase for finding literal equivalents in IF, maybe you
can give a few hints to save a lot of time.
I have a com server which calls a dll written by a 3rd party.
The 3rd party wants to switch to IF but I want to keep the com server on CVF.
The dll looks like:
--------------------------
module mydll
real(8),save:: realVar
real(8),allocatable,save:: realArr
etc...
contains
pure real(4) function mydll_somefunc(args)
!DEC$ ATTRIBUTES DLLEXPORT:: somefunc
end function
....
end moddule
------------
The CVF com server calls this dll which is to be built w/ IF.
The only way I have figured out to do this in cvf was to write an interfacing module with lines like
-------------
module UserFunctionInterface
interface
pure real(4) function mydll_somefunc(args)
!dec$ attributes dllimport,decorate, alias: "MYDLL_mp_MYDLL_SOMEFUNC" :: mydll_somefunc
real(4),intent(in):: args
end function mydll_somefunc
etc...
end module
-------------------------
The interface module is part of the com server project. This scheme works and was the only way
you could recommend doing it a long time ago.
side comment: I wished that the dll could have been used as a simple module so that
I did not have to set its variables by passing in dummy vars/arrays only to copy them into the
module vars. But that is besides the point here.
-------------------------
I have previously given the compile c.l. args I use for the cvf compiler.
Now the question is what advice can you give in porting this scheme over so that the dll can
be written for IF?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm- DLLEXPORTing a module procedure. I know there were bugs in this area in the past - not sure if 6.6B squashed them all.
I don't see why your CVF solution wouldn't work for Intel Fortran, except that IF doesn't support DECORATE, so you'd have to spell out the full decorated name. Be aware that IF defaults to the C calling mechanism, so you'll have to adjust the compile options for that.
Steve
I don't see why your CVF solution wouldn't work for Intel Fortran, except that IF doesn't support DECORATE, so you'd have to spell out the full decorated name. Be aware that IF defaults to the C calling mechanism, so you'll have to adjust the compile options for that.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Thanks. This scheme was a solution you recommended, and I do not really understand what all the keywords like "decorate" do.
1. are you saying that it is possible that I no longer need the interface module to do this?
2.Will this simplified scheme help make the conversion to IF easier?
3. If you think that it is not worth fooling with the existing scheme because it works. Are you saying that the _rest_ of this code should work as is as long as I "spell out the full name"? for ex. I would had assumed that directive like !DEC$ need to change as well.
4.How do I find out the "full name" and where does it go?
Is it the junk in upper case with _mp_ and do I have to make calls to the whole messy name? or...
5. What compile options must I change to "adjust to the C calling mechanism"?
Many Thanks in adv.,
Tim
Thanks. This scheme was a solution you recommended, and I do not really understand what all the keywords like "decorate" do.
1. are you saying that it is possible that I no longer need the interface module to do this?
2.Will this simplified scheme help make the conversion to IF easier?
3. If you think that it is not worth fooling with the existing scheme because it works. Are you saying that the _rest_ of this code should work as is as long as I "spell out the full name"? for ex. I would had assumed that directive like !DEC$ need to change as well.
4.How do I find out the "full name" and where does it go?
Is it the junk in upper case with _mp_ and do I have to make calls to the whole messy name? or...
5. What compile options must I change to "adjust to the C calling mechanism"?
Many Thanks in adv.,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'd have to try it to see if it works. But I'd guess that Intel Fortran may not support DLLEXPORT of module procedures well at this time.
!DEC$ directives will remain - I know of no plan to change the spelling (and would oppose such a plan were it to be proposed.)
Intel Fortran defaults to the C calling mechanism, arguments by reference, It supports the ATTRIBUTES STDCALL directive like CVF, or change the CVF code to specify C, REFERENCE. I think names are upcased in Intel Fortran. You'll have to play with it to see what works - without seeing your whole application, I can't provide specific suggestions.
Steve
!DEC$ directives will remain - I know of no plan to change the spelling (and would oppose such a plan were it to be proposed.)
Intel Fortran defaults to the C calling mechanism, arguments by reference, It supports the ATTRIBUTES STDCALL directive like CVF, or change the CVF code to specify C, REFERENCE. I think names are upcased in Intel Fortran. You'll have to play with it to see what works - without seeing your whole application, I can't provide specific suggestions.
Steve

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