View previous topic :: View next topic |
Author |
Message |
worleyparsons
Joined: 08 Jan 2015 Posts: 5
|
Posted: Sun Jan 11, 2015 11:54 pm Post subject: Error when creating DLL using SLINK |
|
|
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 |
|
Back to top |
|
 |
worleyparsons
Joined: 08 Jan 2015 Posts: 5
|
Posted: Mon Jan 12, 2015 5:07 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Jan 12, 2015 9:25 am Post subject: |
|
|
I don't think either of these two points are relevant.
I can think of two ways forward.
a) Experiment with a very simple main program and DLL to start with.
If this fails in the same way then post your code here.
b) Create a working main program and DLL that is short and illustrates the problem and post your code here. |
|
Back to top |
|
 |
worleyparsons
Joined: 08 Jan 2015 Posts: 5
|
Posted: Mon Jan 12, 2015 11:23 pm Post subject: |
|
|
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
########################### |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Jan 13, 2015 8:43 am Post subject: |
|
|
What does the main program look like and how do you build the exe and the dll? |
|
Back to top |
|
 |
worleyparsons
Joined: 08 Jan 2015 Posts: 5
|
Posted: Tue Jan 13, 2015 11:34 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
worleyparsons
Joined: 08 Jan 2015 Posts: 5
|
Posted: Tue Jan 13, 2015 11:36 pm Post subject: |
|
|
I have also tried building it in Plato IDE and I get the following error:
*** No main program supplied
Compilation failed. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Jan 14, 2015 9:04 am Post subject: |
|
|
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. |
|
Back to top |
|
 |
|