replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Linking resources
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linking resources

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Ambrus



Joined: 10 Feb 2014
Posts: 5

PostPosted: Mon Feb 10, 2014 11:44 am    Post subject: Linking resources Reply with quote

I have a given compiled resource scrypt (.res) and I would like to use it whit the linker (SLINK).
So I had to decompile the file to a resource scrypt (.rc) but the resource editor i use added some header files to the script.
Using Salford Resource Compiler, I can�t find the correct environment variable to set the path where the resource compiler searces for include files.
So I moved all my files to the c:\Program Files\Silverfrost\FTN95\include\WIN32\ directory (this way the SRC worked), but I got the following error from the linker (SLINK):

*** No main, WinMain or LibMain function

So I have the following questions:
Is the mentioned error caused by the source file?
If not, what should I change?
What environment variable could be used to set the SRC�s include path?
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Feb 10, 2014 1:49 pm    Post subject: Reply with quote

If you are creating an executable, when you link, one of the object files must contain the main program. If you are creating a DLL then SLINK will automatically provide a default LibMain for you.

For a 32 bit operating system, you need a PATH environment variable that includes c:\Program Files\Silverfrost\FTN95\ in the list.
Back to top
View user's profile Send private message AIM Address
Ambrus



Joined: 10 Feb 2014
Posts: 5

PostPosted: Mon Feb 10, 2014 8:26 pm    Post subject: Reply with quote

Thanks for the quick answer.
It looks like I wasn't clear enough about the problem.

Some detail I forgot:

-My OS is windows 7
-I use Silverfrost FTN95

And about my problem:
I try to recreate an existing program but:
-I'm only able to edit some subroutines and functions, so I don't have the original main program.
-Instead I have a *.lib library file and *.res compiled resource scrypt.
-So I have to create a Windows .exe by compiling some *.for files containing only subroutines and functions, then linking the created *.obj files, a *.lib file and a *.res file together.

My attempts so far:
-I used Intel Visual Fortran's trial version, and it worked by runing the following BATCH file:

Code:
@SET IFORT_COMPILER90=C:\Program Files\Intel\Composer XE 2013 SP1
@SET INTEL_SHARED=C:\Program Files\Common Files\Intel\Shared Files
@SET INTEL_LICENSE_FILE=C:\Program Files\Common Files\Intel\Licenses
@SET PATH=%IFORT_COMPILER90%\Bin\ia32;%INTEL_SHARED%\Ia32\Bin;%PATH%
@SET LIB=%IFORT_COMPILER90%\compiler\lib\ia32;%LIB%
@SET INCLUDE=%IFORT_COMPILER90%\compiler\Include;%INCLUDE%

ifort /nologo /O3 /align:dcommons /winapp /c *.for
link  /out:"MyProg.exe" /incremental:no /nologo /subsystem:windows *.obj GivenLibrary.lib GivenResource.res

del UserSub.lib
del UserSub.exp

 pause


-I want to continue the work whit this project, so I changed to Silverfrost FTN95, but I found that SLINK doesn't accept *.res files, instead it accepts a *.obj file generated by Salford Resource Compiler from a *.rc file.
-So I wanted to decompile the compiled resource scrypt (*.res) into a resource scrypt (*.rc) so I had an input file to Salford Resource Compiler. (Maybe this step caused some demage, so the linker doesn't find the WinMain function.) I generated the *.rc file from the *.res file by ResEdit. This resource editor placed some include statements to the beginning of my resource scrypt (*.h header files)
-Then I used Salford Resource Compiler by placing my resource file in the c:\Program Files\Silverfrost\FTN95\include\WIN32 directory and run SRC (Otherwise it wouldn't find the header files.) and it created an object file from the *.rc file without any errors.
-After this I tried to link my subroutine's *.obj, the resource's *.obj and the supplied *.lib files with SLINK and that caused the mentioned error:
Code:

...
[Silverfrost SRC/WIN32 Ver 3.65 Copyright (c) Silverfrost Ltd 2012]
    NO ERRORS  [<WINTEMPOSRC/WIN32 Ver 3.65]

c:\Programing\Fortran\CT\Dokumentacio\other_comp\System_silver>SLINK /OUT:"MyProg.exe" /SUBSYSTEM:WINDOWS   Subroutine.OBJ CompiledResouce.OBJ GivenLibrary.LIB
*** No main, WinMain or LibMain function
...



So my aim is to link *.obj files whit a *.lib and a *.res file.
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Feb 10, 2014 9:48 pm    Post subject: Reply with quote

Linking obj files from different compilers is probably not possible and is not supported.
Back to top
View user's profile Send private message AIM Address
Ambrus



Joined: 10 Feb 2014
Posts: 5

PostPosted: Mon Feb 10, 2014 10:14 pm    Post subject: Reply with quote

I know. That's why I'm trying to change to only Silverfrost products.
The method I wrote in my previous commnet was recommended in the help:
-Use FTN95.exe to create *.obj from *.for
-Use SRC.exe to create *.obj from the *.rc
-Use SLINK to link the *.obj files (ALL generated by Silverfrost products.) and *.lib files and create an *.exe.
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Feb 10, 2014 11:09 pm    Post subject: Reply with quote

If you don't have the code for the original main program then you will not be able to create the corresponding .obj.
Back to top
View user's profile Send private message AIM Address
Ambrus



Joined: 10 Feb 2014
Posts: 5

PostPosted: Tue Feb 11, 2014 12:17 am    Post subject: Reply with quote

So you think, that I won't be able to create a working executable (without Intel Fortran Compiler) using the supplied *.lib and *.res files, because the original developers used Intel programs.

But the creators assured me several times that it doesn't matter which program is used to compile and link.

Does someone have experience with using different linkers to link the exact same *.lib AND|OR *.res files whit object files generated by the corresponding compilers?
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Tue Feb 11, 2014 9:44 am    Post subject: Reply with quote

From what you write, you do not have the source code for the main program. But you do have the object code for the main program within a third party library archive. In this situation I would not even try to link together with (Silverfrost) object code. There is really no reason to expect this to work, at least not without a lot of very complex tweeking.

The easiest way to link with third party libraries is via a DLL but you always need access to the code for the main program.
Back to top
View user's profile Send private message AIM Address
Ambrus



Joined: 10 Feb 2014
Posts: 5

PostPosted: Tue Feb 11, 2014 10:04 am    Post subject: Reply with quote

So you say it's impossible to use other linkers because the library archive only works with Intel?
And what about the "very complex tweeking"? Do you have experience in such problems?
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Tue Feb 11, 2014 3:40 pm    Post subject: Reply with quote

I have never tried it and I don't know of anyone else ever trying to do this.
I essence I don't think that it can be done but I have learned never to say never in this game.

You need either the original compiler or the source code for the main program.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group