Silverfrost Forums

Welcome to our forums

Adding FTN95 lib to VS C project

10 Apr 2012 6:48 #9973

I am having problems adding a FTN95 Fortran library to my Visual C Project using visual studio. The C project is for win32, not .NET. I am compiling my C project as C, not cpp, and I am using the MS C compiler that comes with VS2010.

My FTN95 library contains one top level function that takes no arguments that I believe can be found by the C linker, as I have selected Export All in the FTN95 library project.

It looks to me that I may also need to include a fortran run time library or something in my Visual C project, instead of just the code library. But I can not find any reference to having to do this. The code library also uses a module, if that makes a difference.

Any help on what I may need to do will be appreciated. .

I get the following errors:

Generating Code... 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _ADJUSTL# referenced in function _GASDATAMOD!WRITECSV_CHAR 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _WSF1## referenced in function _GASDATAMOD!INITGASDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _R4#WSF referenced in function _GASDATAMOD!INITCSV_REAL 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _I4#WSF referenced in function _GASDATAMOD!INITCSV_INT 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _CH#WSF referenced in function _GASDATAMOD!INITCSV_REAL 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _WSF2# referenced in function _GASDATAMOD!WRITECSV_END 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _RSF1## referenced in function _GASDATAMOD!INITGASDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _GETARG referenced in function _GASDATAMOD!COMMANDLINE 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol ___adjust_stack_f referenced in function _GASDATAMOD!DEFINEORDER 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _CCOMP# referenced in function _GASDATAMOD!DEFINEORDER 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _I4#RSF referenced in function _GASDATAMOD!INITGASDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol ___CCOPY referenced in function _GASDATAMOD!INITGASDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol ___CONCAT referenced in function _GASDATAMOD!INITGASDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _OPEN## referenced in function _GASDATAMOD!INITGASDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _RWIN## referenced in function _INITANNUALDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol ___alloc_times referenced in function _ANNUALDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol ___DEALLOCATE referenced in function _ANNUALDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol ___ALLOCATE1 referenced in function _ANNUALDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _RSU1## referenced in function _ANNUALDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _XSUX# referenced in function _ANNUALDATA 1>gasdata.lib(GasData.obj) : error LNK2019: unresolved external symbol _EXIT referenced in function _GASDATAMAIN 1>.\Debug\GasplanAccessOutput.exe : fatal error LNK1120: 21 unresolved externals ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

10 Apr 2012 10:49 #9978

You will need to reference salflibc.dll.

However, this will probably not solve all of the issues and you should consider using SCC as your C compiler. Then everything will link together by using SLINK.

10 Apr 2012 11:30 #9979

Hi Paul Thanks for your quick response. I did try adding the static library salflibc.lib. However I then got the error message saying that printf etc had been redefined. I expect in a clash with libc.lib from MS. Is there anything I can do about this, or is this why you say to use SCC?

Is there a way to still use the VS project, but use SCC instead ? Or is the only option Plato or a Makefile ?

Thanks

10 Apr 2012 12:54 #9980

salflibc.lib is a combined static and import library that is used by SLINK to resolve external functions that are accessed at runtime from salflibc.dll.

There is probably a way to use the Microsoft compiler but I don't know how to do this and this approach is not supported by Silverfrost. Basically you will need to find out how to set the application's entry point _SALFStartup.

You may be able to use SCC from Visual Studio, however, Plato is very much like Visual Studio and is configured to handle FTN95, SCC and SLINK in a seamless way.

Please login to reply.