f



Calling a Fortran DLL from Fortran

In calling a FORTRAN DLL, from FORTRAN code, one needs to place the DLL in =
a path that is searched by the Windows operating system. Placing the DLL in=
 a folder other than the ones in the PATH environment variable, will cause =
the call to fail. Does anyone know how to call a DLL that is stored in a fo=
lder not in the Windows path? In VB one uses the Declare statement to accom=
plish that. I tried GETENVQQ to get the Path environment variable, then aug=
ment the  path of the DLL and then using the SETENVQQ to update the PATH en=
vironment variable but I haven't been able to succeed. Any ideas would be g=
reat.
0
Michael
8/9/2014 5:04:29 PM
comp.lang.fortran 11941 articles. 1 followers. Post Follow

3 Replies
2329 Views

Similar Articles

[PageSpeed] 0

On Sat, 9 Aug 2014 10:04:29 -0700 (PDT), Michael <michael.caracotsios@gmail.com>
 wrote in <fce6d0e7-02d3-4678-ad75-80f9679ab3c3@googlegroups.com>:

> In calling a FORTRAN DLL, from FORTRAN code, one needs to place the DLL 
> in a path that is searched by the Windows operating system. Placing the 
> DLL in a folder other than the ones in the PATH environment variable, will 
> cause the call to fail. Does anyone know how to call a DLL that is stored 
> in a folder not in the Windows path? In VB one uses the Declare statement 
> to accomplish that. I tried GETENVQQ to get the Path environment variable, 
> then augment the path of the DLL and then using the SETENVQQ to update the 
> PATH environment variable but I haven't been able to succeed. Any ideas 
> would be great.

	Not Fortran-specific, but IME it suffices to have the .dll in the 
same directory as the executable.  Works for stuff I've written, and in 
various seti@home installations.  There may be an environment variable 
similar to Linux's LD_LIBRARY_PATH but I've never felt the need to look 
for it.

-- 
Ivan Reid, School of Engineering & Design, _____________  CMS Collaboration,
Brunel University.    Ivan.Reid@[brunel.ac.uk|cern.ch]    Room 40-1-B12, CERN
        KotPT -- "for stupidity above and beyond the call of duty".
0
Ivan
8/9/2014 5:42:04 PM
On Sat, 2014-08-09 at 10:04 -0700, Michael wrote:=20
> In calling a FORTRAN DLL, from FORTRAN code, one needs to place the DLL i=
n a path that is searched by the Windows operating system. Placing the DLL =
in a folder other than the ones in the PATH environment variable, will caus=
e the call to fail. Does anyone know how to call a DLL that is stored in a =
folder not in the Windows path? In VB one uses the Declare statement to acc=
omplish that. I tried GETENVQQ to get the Path environment variable, then a=
ugment the  path of the DLL and then using the SETENVQQ to update the PATH =
environment variable but I haven't been able to succeed. Any ideas would be=
 great.

What VB does is closer to dynamic loading.  You can use
LoadLibrary/GetProcAddress/FreeLibrary from Fortran, through C
interoperability, for a similar effect.


Take a look at: http://en.wikipedia.org/wiki/Dynamic_loading

--
John.


0
JWM
8/9/2014 8:32:00 PM
On 8/9/2014 1:04 PM, Michael wrote:
> In calling a FORTRAN DLL, from FORTRAN code, one needs to place the DLL in a path that is searched by the Windows operating system. Placing the DLL in a folder other than the ones in the PATH environment variable, will cause the call to fail. Does anyone know how to call a DLL that is stored in a folder not in the Windows path? In VB one uses the Declare statement to accomplish that. I tried GETENVQQ to get the Path environment variable, then augment the  path of the DLL and then using the SETENVQQ to update the PATH environment variable but I haven't been able to succeed. Any ideas would be great.
>

When loading an executable that is linked to a DLL, that is, not using 
dynamic loading as VB does, Windows has a list of places it looks for 
the DLL. This can vary somewhat, but other than adding to PATH, you'd 
typically want to put the DLL in the same directory as the EXE.

For more details see 
http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx

-- 
Steve Lionel
Developer Products Division
Intel Corporation
Merrimack, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
   http://software.intel.com/en-us/forums/
Intel Software Development Products Support
   http://software.intel.com/sites/support/
My Fortran blog
   http://www.intel.com/software/drfortran

Refer to http://software.intel.com/en-us/articles/optimization-notice 
for more information regarding performance and optimization choices in 
Intel software products.
0
Steve
8/12/2014 7:19:42 PM
Reply:

Similar Artilces:

How to link an Fortran f77 dll (Absoft Pro Fortran) with an existing f77 dll (Visual Fortran)
Hello, i have to connect an existing Fortran F77 DLL written in Visual Fortran to a new one. How can i link two DLLs together? I search an example, to understand how it works. Please help me! At the moment i have a dll called "example.dll". Within this dll are three functions: DOUBLE PRECISSION FUNCTION EXF1(A,B) !DEC$ ATTRIBUTES DLL_EXPORT :: EXF1 !DEC$ ATTRIBUTES ALIAS : "EXF1" :: EXF1 REAL*8 A,B EXF1=A*2*B RETURN End DOUBLE PRECISSION FUNCTION EXF2(A,B) !DEC$ ATTRIBUTES DLL_EXPORT :: EXF2 !DEC$ ATTRIBUTES ALIAS : "EXF2" :: EXF2 REAL*8 A,B EXF2...

Help needed! Fortran Dll works for compaq fortran not for Intel Fortran
Dear all, I am porting a compaq fortran project (version 6.x) over to the intel fortran compiler (version 8.0). However, crash always happens at the internal write statement under the intel fortran compiler. ========= project brief: ========= The soultion comprises two parts, one is the c++ project, which in charge of the user interface, the other project is a Fortran Dll project. The Fortran Dll is invoked by the C++ project. the problem I meet here is every simple, the C++ project is just a framework of the dialog based mfc win32 application. In the code response to the click OK button, it...

c++ calling fortran and fortran calling C++
Hi, For my application in C++, I need to call a subtroutine in fortran. This subroutine must call a function of my program. I'm trying to use pointer of my function but I have segmentation fault. the fortran code is: subroutine dlltest [dllexport] (c_msg,e1,e2,e3,i,r,d,str) c implicit none integer i,l,m,length real*4 r double precision d character*128 e1,e2,e3,str,aux,aux2 external c_msg,length c first, write parameters to a file open(1,file='test.out',status='unknown') rewind(1) c write(1,*) 'function pointer: ',c_msg write(1,*) 'integer: ...

Help needed! Fortran Dll works for compaq fortran not for Intel Fortran #2
Dear all, I am porting a compaq fortran project (version 6.x) over to the intel fortran compiler (version 8.0). However, crash always happens at the internal write statement under the intel fortran compiler. ========= project brief: ========= The soultion comprises two parts, one is the c++ project, which in charge of the user interface, the other project is a Fortran Dll project. The Fortran Dll is invoked by the C++ project. the problem I meet here is every simple, the C++ project is just a framework of the dialog based mfc win32 application. In the code response to the click OK button, it...

mex - matlab calls fortran which calls matlab which calls fortran
Dear All, I'm trying to link matlab and fortran with mex files and engine matlab, in linux OS. My general purpose is the following: 1) a matlab script A calls a mex function B based upon fortran source code 2) mex function B calls another function in matlab C within matlab engine 3) matlab routine C calls another mex file in fortran D While i'm able to do steps 2) and 3), I can't do step 1). Before to show the code, please reply to this simple question: Is it possible to build the overall process 1-3? On 8 Okt, 16:37, "Michele Catalano" <cata...@yahoo.it> wr...

Calling FORTRAN functions rather than FORTRAN subroutines via call
Hi everybody, all examples I know show how to call a FORTRAN subroutine. I have a lot of FORTRAN code regarding thermophysical properties of water, steam, smoke gas etc. This code consists of many FORTRAN functions. I wish to call them inside scilab. Is it possible? If yes how can the function return value be obtained? Thank you very much, many greetings Eberhard On 2 jan, 14:41, i...@efranz.de wrote: > Hi everybody, > > all examples I know show how to call a FORTRAN subroutine. I have a > lot of FORTRAN code regarding thermophysical properties of water, > ...

Calling Fortran 77 from Fortran 95
When calling Fortran 77 from Fortran 95, how can I make sure the compiler will pass a contiguous array and not a dope array struct? On 2011-03-06 14:07:38 -0400, sturlamolden said: > When calling Fortran 77 from Fortran 95, how can I make sure the > compiler will pass a contiguous array and not a dope array struct? In a narrow sense your question is meaningless as F77 is a subset of F95. What you probably meant was what happens when a F95 compiler finds that it does not have an explicit interface to some procedure. That is well defined and yields what you are probably thinking of as...

Fortran mex-file calling fortran 90 library.
Hi all, I manage to make fortran 90 mex-files by calling fortran subroutine already compiled in a distinct object file (sub.o). I would like now make the same but from "my own true library" (made with modules in fortran90) compiled in a archive (.a) with they module files (.mod). I do not find the way to make it. I mean, how to call library (made with modules fortran90) from fortran mex-files. Anyone have an idea, how it is possible to do that? Thank Fabien PS: This library works fine for any fortran developer who make call it. "Fabien Blarel" <blare...

A Fortran book for returning to Fortran?
What book would you recommend for returning to Fortran after many years without it? I have several years of Fortran experience, most of it with versions before Fortran 77, and never did learn many of the new features of Fortran 77. Robert Miles On 10/23/2011 03:53 AM, Robert Miles wrote: > What book would you recommend for returning to Fortran after many years > without it? > > I have several years of Fortran experience, most of it with versions > before Fortran 77, and never did learn many of the new features of > Fortran 77. How about Fortran 95/2008 ? Is there a rea...

Many Fortran code! How to call Fortran code from C/C++?
Hi all, As a C/C++ programmer, there are a few reasons to use Fortran: (1) Fortran is very similar to Matlab and easy to port; (2) Fortran has support of complex numbers and vectorized numbers and the operations in Fortran are naturally element-wise, operating on a whole vector. (3) There are many scientific codes are in Fortran. ------------- So how do I call Fortran program from my C program? I am using MSVS. NET 2003, VisualC++ and Intel C++ therein, and also the Intel Visual Fortran therein. To give an example, I want to call a Fortran program from C++, which is in its bare form, it ...

Fortran to C to Fortran Arrays
I'm doing a little research. I want to create a multi-dimensional array in fortran containing real values and pass it to a C/C++ program. In the C/C++ program the array will be loaded with values gathered using a libjpeg library or something (haven't figured that out yet). Then I want to return this array back to the Fortran program, loaded with data so that it can be handled there. I have not started to write code yet on this I am just researching some. Can this be done? deadpickle wrote: > I'm doing a little research. I want to create a multi-dimensional > array in fortran...

Calling a Fortran 77 library in a Fortran 90 mex function
Hi, I am working in creating a mex file that calls a Fortran 77 library (with legacy code). I created the mexFunction in Fortran 90. The library is compiled with the Intel Fortran 11 compiler. I am also using the same compiler in Matlab (I don't know if the library and the mex have to be compiled with the same compiler). Anyways, the way I am compiling the mex in Matlab is by typing: >> mex -f mexopts.bat mexFunction.f90 v581flowarea.lib The mexopts.bat contains the compiler options, flags, path, etc. I get the following error message: %----------------------------------------...

Fortran
Is there cheaper Fortran compilers to Mac Os X than Absoft Pro Fortran v9.0 for OS X or IBM XL Fortran Compiler 8.1 for OS X Commercial versions are Pro Fortran Compiler & Tools 9.0 97PCOSX1 $899.00~ Buy now and XL Fortran Compiler & Tools 8.1 XLFOSX381C $999.00 Buy now Heikki Jamsa heikki.jamsa@mail.suomi.net On Fri, 26 Nov 2004 02:21:49 +0200, Heikki J�ms� (heikki.jamsa@mail.suomi.net) wrote: > > Is there cheaper Fortran compilers to Mac Os X > than Absoft Pro Fortran v9.0 for OS X > or > IBM XL Fortran Compiler 8....

fortran
What's the fortran equivalent to C's kandr2? If there is any. Bill "Bill Cunningham" <nospam@nspam.invalid> wrote in news:kbameg$2ci$1@dont- email.me: > What's the fortran equivalent to C's kandr2? If there is any. > > Bill > > > My crystal globe is a bit fuzzy at the moment. What is kandr2??? I dont recognize it as a legal keyword/function. Google wont show a man page for it. Sjouke Burry wrote: > "Bill Cunningham" <nospam@nspam.invalid> wrote in > news:kbameg$2ci$1@dont- email.me: ...

Web resources about - Calling a Fortran DLL from Fortran - comp.lang.fortran

Calling Dr. Death - Wikipedia, the free encyclopedia
Calling Dr. Death (1943) is the first of the Universal Pictures Inner Sanctum mystery films . The "Inner Sanctum" franchise originated with a ...

List of country calling codes - Wikipedia, the free encyclopedia
This is a list of country calling codes defined by ITU-T recommendations E.123 and E.164 , also called IDD ( International Direct Dialling ) ...

Calling Batman: Bane Takes Over Ecko Unlimited Facebook Page
Bane, the villain in upcoming Batman feature film The Dark Knight Rises , turned his criminal mind toward the Ecko Unlimited Facebook page , ...

Facebook Video Calling - Facebook
Bring your conversations to life on Facebook. With face-to-face video calling, now you can watch your friends smile, wink and LOL. To get started, ...

Facebook’s Talktime program in India pays new mobile users in calling credit
... Facebook has launched its Talktime program in India which gives every new user who signs up with a mobile device 50 Rupees (almost $1) in calling ...

Berlin Calling (@neuraum) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Calling all foodies: Here comes @TwitterFood
There are many thousands of food-related Tweets people send on Twitter each day – Tweets about meals, ingredients, favorites, recipes and dining ...

Rounds Video Calling + Chat for iPhone 4, iPhone 4S, iPhone 5, iPhone 5c, iPhone 5s, iPad 2 Wi-Fi, iPad ...
Get Rounds Video Calling + Chat on the App Store. See screenshots and ratings, and read customer reviews.


Malcolm Turnbull makes surprise visit to Iraq, calling for Europe to 'step up'
Prime Minister Malcolm Turnbull has called on European countries to &quot;step up&quot; with stronger help to defeat the so-called Islamic State ...

Resources last updated: 1/26/2016 3:26:12 PM