Adept Scientific - English
The world's best software for research, science and engineering.
flag arrow
clearclear
 

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Download a Demo
• Request a Demo
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 12 Professional
Maple 12 Academic
Maple 12 Student Use
Recorded Online Seminars
FREE Training Resources
Maple Application Briefs
Maple Adoption Program

MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] RE: external calling fortran on windows

Search email archive for  

[MUG] RE: external calling fortran on windows
Author: Alec Mihailovs    Posted: Tue, 21 May 2002 18:10:02 -0400

>> From: Alec Mihailovs "amihailo"

Maple couldn't access TEST because it was not exported.
The subroutine test should contain something like this:

!DEC$ ATTRIBUTES STDCALL, ALIAS : 'TEST' :: TEST

or

!DEC$ ATTRIBUTES DLLEXPORT :: TEST
!DEC$ ATTRIBUTES ALIAS:'TEST' :: TEST

Also, the procedure define_external might need including FORTRAN:

test := define_external('test','FORTRAN',LIB="test.dll");

The procedure of using lcc for creating dll is described in
http://www.q-software-solutions.com/lccwin32/manual/Advanced.htm

I don't have access to Visual Fortran and lcc at the moment and I
don't want to post detailed instructions without checking them first.
Recently I posted a description of using Visual Studio 6 for
creating dll. I will explain here how to use the best free compiler
available, cygwin gcc, for creating dlls.

First, one should obtain the compiler, downloading the complete
cygwin system from http://cygwin.com .

Second, download the instructions for dll creations,
dllhelpers-0.4.0.tar.bz2 and hello-1.0.tar.gz from
http://www.neuro.gatech.edu/users/cwilson/cygutils/dll-stuff/index.html

Start cygwin clicking on the desktop icon. Type

rxvt -sl 2000 -e bash&

That will start rxvt which looks better that the standard DOS prompt.
We will use it for further typing.

Suppose that you downloaded dllhelpers in your home folder,
C:\cygwin\home\Alec (for me). In that case type

bzip2 -d -c dll* | tar xv

That will decompress the files and extracts them into the
dllhelpers-0.4.0 folder. Then, type

cp -r dll*/c mapledll

That will create a directory mapledll and copy files from the
directory dllhelpers-0.4.0/c into it. Switch to that directory:

cd mapledll

Now we need to edit Makefile. Type

vim Makefile

Type :9 and hit enter. That will move the cursor to line 9,
starting from CFLAGS; then type A. That will move cursor to the
end of the line and switches to the text inserting mode. Type
the following, starting from a space,

-mrtd -mno-cygwin

Then click Esc key at the top left corner of the keyboard,
type :wq and hit enter. That will save your changes.
Don't be discouraged if something goes wrong during the process.
In the worst case just hit escape, type :q! and hit enter. That will
return you to the bash leaving the file unchanged, so you could try again.
Certainly, instead of vi one can use a windows text editor saving UNIX
type line endings. PFE is a good free text editor, for instance.

Without adding those 2 flags, a dll will be created, but will be
unusable from Maple. Now, when you made the necessary changes to
the Makefile, and you returned from vim to a bash prompt, type

make

That will create a dll containing many mathematical functions.
To check if the dll was created correctly, type

./usedll

and look at the results. If everything looks OK, start Maple 7,
and try to access some of the dll functions from Maple. For the
first function it will look as follows:

> int_square := define_external(
> 'dll_int_square',
> 'i'::integer[4],
> 'RETURN'::integer[4],
> LIB="C:/cygwin/home/Alec/mapledll/cygcdll.dll"):

> int_square(5);
25

It is easy to modify it for the other functions in the dll. One
can find their names either in cdll.c, or in usedll.c .

Good luck,
Alec Mihailovs
http://webpages.shepherd.edu/amihailo/

-----Original Message-----
>> From: Theodore Kolokolnikov "tkolokol"

I have been trying to call fortran code from maple7 on windows. However no
matter what I try, I keep getting:

> test := define_external('test',LIB="test.dll");
Error, external lookup of test: The specified procedure could not be
found.

The contents of test.f are as simple as you can get, namely:

subroutine TEST
end subroutine TEST

I don't have Microsoft C/C++ but I do have a free "lcc" compiler which is
able to generate dll. If anybody has been able to use "lcc" for this, I
would be grateful to know how as well. I'd be willing to use C rather than
fortran.

[View Complete Thread]



Previous by date: [MUG] RE: DLL, Alec Mihailovs
Next by date: [MUG] RE: evaluating _F1 /_F2 in pdsolve o/p,  Willard, Daniel Dr DUSA-OR
Previous thread: [MUG] evaluating _F1 /_F2 in pdsolve o/p,  Nagaraj Mahavir
Next thread: [MUG] evaluating _F1 /_F2 in pdsolve o/p,  Nagaraj Mahavir



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055