Silverfrost Forums

Welcome to our forums

Error when creating DLL using SLINK

11 Jan 2015 10:54 #15283

Hi

I was attempting to create a DLL file using the 'ftn95' and 'slink' commands. Running the following command creates the obj file with out any problems: ftn95 user_force.f90

I then run the slink command with the following inputs: dll LO USER_FORCE.OBJ EXPORTALL FILE USER_FORCE.DLL

The following error message is produced during this process:

##################################### Runtime error from program:c:\program files (x86)\silverfrost\ftn95\slink.exe Access Violation The instruction at address 004196c8 attempted to read from location 0013f20c

00419426 loadDll(<ptr>char,int) [+02a2]

004028ed loadObject(<ptr>char) [+0291]

004259d9 loadCatenatedObject(<ptr>char) [+02ac]

00402c17 loadNamedObjectFile(<ptr>char) [+0143]

00420708 findDLL(<ptr>char) [+01b0]

004208d0 loadStandardDLLs(void) [+01b2]

0040766a parcelUpExe(void) [+0857]

004081d9 processFileCommand(<ptr>char,int) [+023d]

eax=00142c6b ebx=001425f4 ecx=0014191c edx=00000000 esi=000005dc edi=0013f208 ebp=0370e734 esp=0370e680 IOPL=1 ds=002b es=002b fs=0053 gs=002b cs=0023 ss=002b flgs=00010203 [CA OP NZ SN DN NV]

004196c8 mov esi,[edi+0x4] 004196cb mov [ebp-0x7c],esi 004196ce push 0xf0f0f0f0

#########################

Can you please let me know what might be the problem?

I am running Silverfrost FTN95 version 5.3 on 64-bit Windows7 Enterprise. I have Microsoft .NET framework 4.5.1 installed

Thanks in advance

12 Jan 2015 4:07 #15284

Looking further into this issue, I have come across a couple of things that may be causing the problem:

  1. Required DLLs not installed properly (do I need to do anything special in addition to just installing FTN95)?
  2. slink not compatible with 64-bit windows (I have version 5.3 installed, could this be a problem)?

Thanks again

12 Jan 2015 8:25 #15285

I don't think either of these two points are relevant.

I can think of two ways forward.

  1. Experiment with a very simple main program and DLL to start with. If this fails in the same way then post your code here.

  2. Create a working main program and DLL that is short and illustrates the problem and post your code here.

12 Jan 2015 10:23 #15286

Thanks for the suggestion Paul.

I tried several other bits of code that use to compile using the same version of Silverfrost several years ago and I get the same error dump as posted above each time. So I don't think it's a code dependent problem.

Below is a simple if-then-else routine that still produces the same error:

###########################

SUBROUTINE USER_FORCE(MODE,FORCE)

IMPLICIT NONE INTEGER MODE, FORCE

IF (MODE.EQ.0) THEN
    FORCE = 1

ELSEIF (MODE.EQ.1) THEN        
    
    FORCE = 2

ELSEIF (MODE.EQ.99) THEN

    FORCE = 3

ELSE     

    CONTINUE

ENDIF
RETURN

END SUBROUTINE USER_FORCE

###########################

13 Jan 2015 7:43 #15288

What does the main program look like and how do you build the exe and the dll?

13 Jan 2015 10:34 #15292

The DLL is called by an external program so I can't provide anything on that, is that what you mean? All I need is to compile this subroutine as a DLL

In terms of building the DLL, I run FTN95 to get the obj file, the I run the SLINK command with the following inputs: dll LO USER_FORCE.OBJ EXPORTALL FILE USER_FORCE.DLL

This is all done in the command prompt in Windows.

13 Jan 2015 10:36 #15293

I have also tried building it in Plato IDE and I get the following error:

*** No main program supplied Compilation failed.

14 Jan 2015 8:04 #15296

Your code and commands work OK for me.

It is odd because SLINK should at least fail gracefully and let you know what when wrong.

I have no suggestions other than to try a) re-installing FTN95 etc. b) try using a different machine c) try using a new Personal Edition on a different machine.

If you get it to link then you may not be able to access the DLL from a third party executable. It will depend on the calling convention etc used by the executable.

Please login to reply.