For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2004 > calling matlab from fortran









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author calling matlab from fortran
Don Bruce

2004-05-12, 9:08 pm

I would greatly appreciate it if someone could help me work out a
problem I have when trying to call matlab from fortran. I am using
matlab 6.5.1 and CVF6.6.

When I am trying to execute the compiled program fengdemo.f I get the
following error message:

The procedure entry point ENGPUTVARIABLE@16 could not be located in
the dynamic link library libeng.dll.

I have included the libraries libmat.lib libeng.lib libmx.lib in the
object/libraries modules box under 'settings' -> 'links'.

Plus, I have created a link to the libraries in the tools -> options
-> directories -> libraries (library lifes option).

Is this the correct approach? If not, is there a better way.

Moreover, is anyone aware of relevant documentation. Many people seem
to have found sililar problems (especially related to the program
fengdemo.f).

Many thanks
Don
Gerry Thomas

2004-05-12, 9:09 pm


"Don Bruce" <fortran_matlab2000@yahoo.com> wrote in message
news:d18cbf29.0405070636.3cc59816@posting.google.com...
> I would greatly appreciate it if someone could help me work out a
> problem I have when trying to call matlab from fortran. I am using
> matlab 6.5.1 and CVF6.6.
>
> When I am trying to execute the compiled program fengdemo.f I get the
> following error message:
>
> The procedure entry point ENGPUTVARIABLE@16 could not be located in
> the dynamic link library libeng.dll.
>
> I have included the libraries libmat.lib libeng.lib libmx.lib in the
> object/libraries modules box under 'settings' -> 'links'.
>
> Plus, I have created a link to the libraries in the tools -> options
> -> directories -> libraries (library lifes option).
>
> Is this the correct approach? If not, is there a better way.
>
> Moreover, is anyone aware of relevant documentation. Many people seem
> to have found sililar problems (especially related to the program
> fengdemo.f).
>


Check to see if an export entry for ENGPUTVARAIBLE is present in
libeng.def. It is not present for Matlab R12 but you mention that you're
using R13. Also, crosspost to comp.soft-sys.matlab.

--
E&OE

HTH,
Gerry T.


Don Bruce

2004-05-12, 9:09 pm

"Gerry Thomas" <gfthomas@sympatico.ca> wrote in message news:<5XNnc.7333$dr1.221237@news20.bellglobal.com>...
> "Don Bruce" <fortran_matlab2000@yahoo.com> wrote in message
> news:d18cbf29.0405070636.3cc59816@posting.google.com...
>
> Check to see if an export entry for ENGPUTVARAIBLE is present in
> libeng.def. It is not present for Matlab R12 but you mention that you're
> using R13. Also, crosspost to comp.soft-sys.matlab.


The export entry for ENGPUTVARAIABLE is indeed present in libeng.def.
I have still had no luck. In fact now the error message I get is a
little different:

"The application has failed to start because libmx.dll was not found.
Reinstalling the application may fix this problem."

(I can't remember exactly what I changed because I have tried almost
everything).
I have have included a path to the directory containing the 'lost' dll
(using tools->options->executables), but it doesnt seem to find it.

??????
Jugoslav Dujic

2004-05-12, 9:09 pm

Don Bruce wrote:
| The export entry for ENGPUTVARAIABLE is indeed present in libeng.def.
| I have still had no luck. In fact now the error message I get is a
| little different:
|
| "The application has failed to start because libmx.dll was not found.
| Reinstalling the application may fix this problem."
|
| (I can't remember exactly what I changed because I have tried almost
| everything).
| I have have included a path to the directory containing the 'lost' dll
| (using tools->options->executables), but it doesnt seem to find it.

No can do -- that setting affects only tools ran from VS "Tools" menu.
Instead, you should append that directory to your PATH environment variable
(My computer->Properties->Advanced->Environment variables).

Doesn't MATLAB setup do it for you? Or it got screwed in the process?

--
Jugoslav
___________
www.geocities.com/jdujic

Please reply to the newsgroup.
You can find my real e-mail on my home page above.

Gerry Thomas

2004-05-12, 9:09 pm


"Don Bruce" <fortran_matlab2000@yahoo.com> wrote in message
news:d18cbf29.0405110707.77bf026@posting.google.com...
> "Gerry Thomas" <gfthomas@sympatico.ca> wrote in message

news:<5XNnc.7333$dr1.221237@news20.bellglobal.com>...
you're[color=darkred]
>
> The export entry for ENGPUTVARAIABLE is indeed present in libeng.def.
> I have still had no luck. In fact now the error message I get is a
> little different:
>
> "The application has failed to start because libmx.dll was not found.
> Reinstalling the application may fix this problem."
>
> (I can't remember exactly what I changed because I have tried almost
> everything).
> I have have included a path to the directory containing the 'lost' dll
> (using tools->options->executables), but it doesnt seem to find it.
>
> ??????


This works:

1. Make a CVF console app using fengdemo.f90 (free form and change all the
C's to ! in the MATLAB .f file).
2. -> Project Settings/Link/General make sure that the Object/library
modules: reads
libmatpm.lib libmmfile.lib libmatlb.lib libmx.lib libmat.lib libeng.lib
kernel32.lib ...
3. ditto for Project Settings/Link/Input and that the Additional library
paths: reads
C:\matlabR12\extern\lib\win32,C:\matlabR
12\extern\lib\win32\microsoft\msvc6
0
4. You don't need to fiddle with anything else. Rebuild and execute.
--
E&OE

HTH,
Gerry T.


Gerry Thomas

2004-05-12, 9:09 pm


"Gerry Thomas" <gfthomas@sympatico.ca> wrote in message
news:0Ffoc.19050$dr1.499834@news20.bellglobal.com...
>
> "Don Bruce" <fortran_matlab2000@yahoo.com> wrote in message
> news:d18cbf29.0405110707.77bf026@posting.google.com...
> news:<5XNnc.7333$dr1.221237@news20.bellglobal.com>...
the
the[color=darkred]
options[color=darkred]
seem[color=darkred]
> you're
>
> This works:
>
> 1. Make a CVF console app using fengdemo.f90 (free form and change all

the
> C's to ! in the MATLAB .f file).
> 2. -> Project Settings/Link/General make sure that the Object/library
> modules: reads
> libmatpm.lib libmmfile.lib libmatlb.lib libmx.lib libmat.lib libeng.lib
> kernel32.lib ...
> 3. ditto for Project Settings/Link/Input and that the Additional library
> paths: reads
>

C:\matlabR12\extern\lib\win32,C:\matlabR
12\extern\lib\win32\microsoft\msvc6[colo
r=darkred]
> 0
> 4. You don't need to fiddle with anything else. Rebuild and execute.
> --
> E&OE
>
> HTH,
> Gerry T.
>
>


PS

Note that instead of specifying the lib paths in Project
Settings/Link/Input/Additional library, ->Tools/Options/Directories/Library
files and create entries for

C:\matlabR12\extern\lib\win32

and

C:\matlabR12\extern\lib\win32\microsoft\
msvc6



Don Bruce

2004-05-12, 9:09 pm

"Jugoslav Dujic" <jdujic@yahoo.com> wrote in message news:<2gc9avF14ahsU1@uni-berlin.de>...
> Don Bruce wrote:
> | The export entry for ENGPUTVARAIABLE is indeed present in libeng.def.
> | I have still had no luck. In fact now the error message I get is a
> | little different:
> |
> | "The application has failed to start because libmx.dll was not found.
> | Reinstalling the application may fix this problem."
> |
> | (I can't remember exactly what I changed because I have tried almost
> | everything).
> | I have have included a path to the directory containing the 'lost' dll
> | (using tools->options->executables), but it doesnt seem to find it.
>
> No can do -- that setting affects only tools ran from VS "Tools" menu.
> Instead, you should append that directory to your PATH environment variable
> (My computer->Properties->Advanced->Environment variables).
>
> Doesn't MATLAB setup do it for you? Or it got screwed in the process?


I have checked and the path is already defined correctly in
environment variable PATH.

In any case I now have a quick and dirty solution to the problem: copy
everything from the relevant directory (in my case
C:\MATLAB6p5p1\bin\win32) into the directory where the executable is
located (I had already tried copying only the relevant files but it
appears to need more...).

Nevertheless, this is still unsatifying, and I would be interested to
hear if anyone has the correct solution.
Thanks
Don
Gerry Thomas

2004-05-12, 9:09 pm


"Gerry Thomas" <gfthomas@sympatico.ca> wrote in message
news:G1goc.19609$dr1.509581@news20.bellglobal.com...
>
> "Gerry Thomas" <gfthomas@sympatico.ca> wrote in message
> news:0Ffoc.19050$dr1.499834@news20.bellglobal.com...
using
> the
in[color=darkred]
> the
> options
> seem
dll[color=darkred]
> the
library[color=darkred]
>

C:\matlabR12\extern\lib\win32,C:\matlabR
12\extern\lib\win32\microsoft\msvc6[colo
r=darkred]
>
> PS
>
> Note that instead of specifying the lib paths in Project
> Settings/Link/Input/Additional

library, ->Tools/Options/Directories/Library
> files and create entries for
>
> C:\matlabR12\extern\lib\win32
>
> and
>
> C:\matlabR12\extern\lib\win32\microsoft\
msvc6
>
>
>


PPS

I've just checked: the CVF project successfully migrates to IVF 8 but you
must append the ..\lib\.. entries to -> Tools/Options/Intel/Libraries, the
CVF migration wizard does the rest.


--
E&OE

Ciao,
Gerry T.
______
"It is dangerous to be right in matters on which the established
authorities are wrong." -- Voltaire.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com