Silverfrost Forums

Welcome to our forums

Can't use /import_lib twice

6 Aug 2013 3:38 #12758

Hello.

I am using Salford Fortran to calculate some multiple-dimensional integrals, for which I need the NAG libraries.

On my old computer (Windows XP) I am able to include the two library dlls I need using /import_lib twice. However, on my laptop (Windows 7) it seems that one can only use /import_lib once. The compiler (ftn95) fails to import the second one, with the message 'Unable to open import library ..' I am finding this all very frustrating.

I would be grateful for any help you can give me,

6 Aug 2013 4:15 #12759

/import_lib will be the same on the two machines so the second DLL must be missing or not 'visible' to the compiler or linker.

If it is present on your new machine then check the PATH etc to make sure it can be accessed.

7 Aug 2013 7:17 #12761

No, I thought of that. In fact I gave the full path to both libraries, and checked by reversing the order of the two calls. ftn95 only implements the first call.

7 Aug 2013 11:16 #12762

I have checked this out.

  1. There have been no changes to the way /import_lib is handled.

  2. /import_lib only takes one file at a time and can be used more than once.

  3. The internal call is to _lopen which is a basic C function for opening the file. This means that the full path must be provided or the folder for the DLL/LIB must be on the PATH.

  4. The file type must be .dll or .lib.

I suggest you try using the full path on the command line. Then try omitting the dll/lib from the command line and try FEXIST@ (for example) to see if the library is visible at run time.

If you are relying on the PATH environment variable, then I can only assume that something is wrong with it.

7 Aug 2013 11:19 #12763

On second thoughts, there could be something wrong with the command line...

Too long? Quotation marks needed and not used?

Are you compiling from a command line or from an IDE?

8 Aug 2013 1:29 #12769

Thanks very much for those suggestions.

It turns out that I can compile on the command line, with

c:\wapps\salford\ftn95 aho1.f /import_lib c\:wapps\salford\naglib\dll\nagsx.dll /import_lib c:\wapps\salford\naglib\dll\nagd01.dll

(all on one line). However, this doesn't work in a batch file, which is what I was previously trying to do. The error message is

'Unable to import library c:\wapps\salford\naglib\dll\nagsx.dll.'

Moreover, on the command line, simply invoking ftn95, without the full path does not work, even though c:\wapps\salford is in the path.

Be that as it may, I now face a more serious problem, namely that slink does not work, even on the command line.

The command

c:\wapps\salford\slink aho1.obj c\:wapps\salford\naglib\dll\nags x.dll c:\wapps\salford\naglib\dll\nagd01.dll

produces an access violation, with the message:

Runtime error from program:c:\wapps\salford\slink.exe Access Violation The instruction at address 004182dd attempted to read from location 0373f6fc

0041804a loadDll(<ptr>char,int) [+0293] 0040274d loadObject(<ptr>char) [+0278] 00424084 loadCatenatedObject(<ptr>char) [+0282] 00402a55 loadNamedObjectFile(<ptr>char) [+012a] 0041f068 findDLL(<ptr>char) [+01a6] 0041f226 loadStandardDLLs(void) [+018e] 004071f1 parcelUpExe(void) [+07b3] 0040b59d parseCommandLine(<ptr><ptr>char) [+030c]

eax=03742290 ebx=03741cf0 ecx=037411c4 edx=00000000 esi=000003e8 edi=0373f6f8 ebp=0370ed30 esp=0370ec7c IOPL=0 ds=0023 es=0023 fs=003b gs=0000 cs=001b ss=0023 flgs=00010203 [CA OP NZ SN DN NV]

004182dd mov esi,[edi+0x4] 004182e0 mov [ebp-0x7c],esi 004182e3 push eax

What on earth is going on??

8 Aug 2013 3:04 #12770

Although I haven't a clue what the solution to your problem is, may I suggest getting into the command prompt window and issuing the PATH command just to see what your path setting actually is (and tell us/Paul)?

I installed FTN95 using default settings and your paths are very different to mine. Perhaps there is a length limit on the path?

Another suggestion is to bring your dlls into the same folder as your source or object files to shorten paths.

I have found that I get a good result from putting salflibc.dll into this folder, as it means my tests can use Paul's latest beta!

Very occasionally files do get corrupted, machines get various types of unwanted software - not necessarily viruses, but also interrupted or otherwise incomplete windows updates etc, and maybe a clean reinstall of FTN95 might help. Is it possible that you are using a version of FTN95 that isn't strictly compatible with Win7 - see FTN95 Revision History, where v 5.50 is noted as addressing this?

I find that downloading the latest PE and seeing if it fixes the problem is a useful test, but installing a PE will mess up your licence info and needs to be done on a spare machine (or reinstall afterwards).

Good luck!

Eddie

8 Aug 2013 3:14 #12771

Does SLINK work at all? Try linking a 'Hello World' program.

If it only fails on big programs, are you using the latest SLINK?

9 Aug 2013 12:18 #12778

Thanks to both of you for your suggestions.

The problem does seem to lie with slink, which doesn't work at all, even on a 'Hello World' program. It hangs when using Plato, and doesn't produce an exe file on the command line.

I don't know which version it is. I am using Salford Plato v2.2, which I simply copied from my other Windows XP machine. The operating system on my laptop is Windows 7 Home Premium (32-bit).

It just looks to me as if I'll have to give up. Things do at least work on my XP machine!

9 Aug 2013 1:10 #12779

For what it's worth, my FTN95pe installs with Plato 4.61, so well worth a update!

Most modern versions put you into a directory structure with Silverfrost in place of Salford, which is a clue that you are years out of date.

You should be able to run the Salford Diagnostics tool (SALDIAG.EXE), and look for instances of (say) FTN95.EXE. The current version is listed as 6.3.5.0, but you can also look for SALFLIBC.DLL.

Paul has made numerous bug fixes and improvements to Clearwin+, so a newer version would improve your experience. If you don't use these facilities, then there is nothing to stop you installing the Personal Edition on your laptop, but compiling production code on your desktop machine.

Eddie

9 Aug 2013 11:21 #12794

Hugh,

Your posted the command: c:\wapps\salford\ftn95 aho1.f /import_lib c\:wapps\salford\naglib\dll\nagsx.dll /import_lib c:\wapps\salford\naglib\dll\nagd01.dll

This looks very wrong, as it implies you have not correctly installed FTN95 to have the appropriate PATH and environment variables in place. You should look at fvars.bat, as this indicates what you should have.

John

10 Aug 2013 9:34 #12803

OK. I've downloaded SiverFrost Plato v 4.61, which works with programs that don't require the NAG library. However, when I try to use the NAG library, it fails with the error message Access Violation.

I suspect I don't have the correct version of the NAG library, which I copied from my old machine. I will experiment, but if anyone knows what would be the appropriate version (for Windows 7 Home Edition, SP1 (32 bit)) that would be very helpful.

Please login to reply.