Silverfrost Forums

Welcome to our forums

Import of NAG library

5 Mar 2013 4:32 #11662

Hello together, I started using silverforst some days ago because I am working on my PhD thesis and I have to make a simulation in fortran. Because of many functions NAG library is very interesting to me. Unfortunately it doesnt work, that I can import the NAG library and I dont know what my mistake is. I have already downloaded the NAG library as .dll and saved it in the same folder like my fortran programm. In Plato I use the 'add references'. With 'external g05saf' I want to start my simple program. The outout of the mistakes is the following: Compiling and linking file: FreeFormat1.f95 Failed to load specific version of the framework, attempt to load latest version I:\Dissertation\Fortran_test\FreeFormat1.F95(19) : error 809 - C:\Program Files\NAG\FL23\fldll234ml\lib\FLDLL234M_mkl.lib is neither a DLL nor a DBK file I:\Dissertation\Fortran_test\FreeFormat1.F95(19) : error 809 - I:\Dissertation\Fortran_test\FLDLL234M_nag.lib is neither a DLL nor a DBK file I:\Dissertation\Fortran_test\FreeFormat1.F95(19) : error 809 - C:\Program Files\NAG\FL23\fldll234ml\lib\FLDLL234M_nag.lib is neither a DLL nor a DBK file Assembly file I:\Dissertation\Fortran_test\FreeFormat1.EXE for .NET 2.0 produced

Compilation failed.

Can anybody help me?

Thanks a lot!

5 Mar 2013 7:24 (Edited: 6 Mar 2013 8:09) #11663

It all depends with/for what compiler library (i suppose you have static one with the extension LIB) was made. Usually such libraries compiled with ancient Microsoft Fortran compiler work OK, then some made with Compaq or Intel may work and may not (they may swear like hell during compilation but work OK). The dynamic (with extension DLL) libraries should work with any compilers. As well as obviously the libraries supplied with Fortran sources.

I do not know your experience with this compiler or just with programming. For simplest experiment try making fortran text file which calls your NAG library routine (let's call your program MyProg.for) and then compile and link it with NAG LIB or DLL library under command prompt this way

FTN95 MyProg.for SLINK MyProg.OBJ NAG.LIB

If all will be fine you'll get MYPROG.EXE file. Of you have Fortran sources of NAG library then extract needed subroutine and either add it to the same file MyProg.for or compile two files separately and slink like above.

If first way is the only option and it does not work because your library is not compatible then may be developers will help. Tricks also exist to wrap the library into DLL with the original compiler then all will definitely work.

6 Mar 2013 7:59 #11664

It looks like you are compiling for .NET when you should be compiling for Win32. If you are using Plato or Visual Studio then it is simply a matter of selecting a different configuration from the toolbar. If you are working from a command line then do not use /CLR.

If you need to use .NET then things get a little more complicated.

6 Mar 2013 9:36 #11665

Yes I was compiling with for .NET. I have changed this to Win32 but then I get the Error: 101c3df7 routine at address 101C3DF7 [+0000]

6 Mar 2013 2:50 #11666

Is this a compilation error or a run time error, etc. A lot more information is needed to be able to diagnose the problem.

6 Mar 2013 3:42 #11667

it is an access violation, with the hint: The instruction at address 101c3df7 attempted to read from location 00003bf2

6 Mar 2013 8:01 #11668

Do you get the error report when compiling or when running the executable? We need all the information you have and probably some you are not aware of yet.

6 Mar 2013 9:58 #11669

Compiling is always succesful. And when I want to run the programm it stops with the above written message

7 Mar 2013 7:49 #11672

OK. Now compile the program using CHECKMATE (/CHECKMATE on the FTN95 command line) and then run the program using the debugger (SDBG). You can do this from Plato or Visual Studio or you can run SDBG as a separate application.

This will probably show where to problem arises.

7 Mar 2013 1:06 #11675

Also if I use the Checkmate I dont get any more information than access violation!

7 Mar 2013 4:47 #11676

But if you run using the debugger it will fail at the line causing the problem and you can do something about it.

7 Mar 2013 8:05 #11677

There is a message, that 'g05saf' is unknown in the FLDLL234M_nag whether it should be in this folder

8 Mar 2013 12:10 #11678

Note that the NAG library version that you have mentioned, FLDLL234ML, uses the STDCALL convention, and therefore you have to compile and link as described at http://www.nag.com/doc/inun/fl23/dll4ml/un.html#ftn95 .

It would be simpler to call NAG FL from FTN95 if you used the better-matched NAG FL version, FLW3223DC. To build the NAG example for C05ADF, all that one would need to do is:

 FTN95 xc05adf.f

 slink xc05adf.obj c:\\nag23DC\\bin\\FLW3223DC_nag.dll
11 Mar 2013 12:54 #11712

Ok, I have downloaded now the FLW3223DC.

Now I dont know how to use this. I thougth that I have just to do 'add references' in the Plato, and link the following FLW3223DC_nag.dll...

But it doesnt work.

So what I have to do, the FTN95 xc05adf.f

slink xc05adf.obj c:\nag23DC\bin\FLW3223DC_nag.dll

I dont know what you mean

11 Mar 2013 1:48 #11713

It should work if you add a reference in Plato.

Take a look at the BuildLog file in the local folder and set if you can work out what has gone wrong.

Is the DLL in the given folder?

What error messages are you getting?

11 Mar 2013 6:20 #11714

Also if I add it as a reference an access violation is returned... If I use 'checkmate' I gets unknown(in FLWDC_nag.dll)

11 Mar 2013 7:14 #11716

Try putting the DLL in the same folder as the executable and change the reference accordingly.

11 Mar 2013 9:30 #11718

I did it in this way, but I received the same result...

12 Mar 2013 1:04 #11722

I thik, that I have found the mistake. For th NAG library a license key seems to be necessary... Does anyone knows where I can get this one?

12 Mar 2013 2:28 #11725

Try sales@nag.co.uk or contact Polyhedron at http://www.polyhedron.com/

Please login to reply.