Silverfrost Forums

Welcome to our forums

newbie to .NET in Visual Studio ...

26 Sep 2009 10:00 #5038

I have successfully (yet to be tested!) created a .DLL file containing various functions and subroutines in plain old .FOR. I also included a .F95 file for a data module in the solution. Everything seemd to work OK resulting in the creation of xxxx.DLL.

Then, I decided to run a test programme in .NET (which had run in FTN95 using a data module inside a .DLL). I set up specific references to FTN95lib.dll, salflibc.dll and the newly created xxxx.dll. I then created my test programme which contains a reference to the data module (USE yyyy and so on) which should be inside the xxxx.dll.

It did not compile and I received errors when I tried to build the solution:

'Cannot find definition for MODULE yyyy' which should have been the .F95 file contained in the xxxx.dll.

Is there something obvious that I am missing? Perhaps the compiler and linker options are missing? But which ones?

Thnk you in advance.

regards

Norm :?

26 Sep 2009 11:59 #5040

You will need separate and different build processes for Win32 and .NET. Everything will need to be rebuilt including the DLL and modules.

26 Sep 2009 11:38 #5045

Thanks Paul. I should have made it clearer that everything was done in .NET. First, I built the .DLL containing subroutines, functions (.FOR code) and the data module (.F95 code). All in one project producing the .DLL.

Then, a new project in .NET with a single programme using references to the .DLL. It is during the compilation of that programme that the error arises.

Sorry, I should have been clearer.

27 Sep 2009 8:12 #5046

First you need to find out where the .MOD files are for your DLL, then you should copy them to your other project or use /MOD_PATH on the FTN95 command line in order to indicate where the compiler can find the .MOD files.

However, you will be limited in what you can do with MODULEs in a DLL. I think you will be OK with MODULE subroutines and functions but you will not be able to directly share module data between a main program and a DLL or between different DLLs.

27 Sep 2009 12:46 #5048

Thanks Paul

Does this mean that .NET behaves quite differently from FTN95 where I have a .DLL with the data module included which works perfectly well between routines within and outside the .DLL?

Why is this?

Norm

27 Sep 2009 1:00 #5049

Paul, forgot to add that I have a function in the .DLL that receives the initial data (in character strings) which is only used by other functions and subroutines within the .DLL. The results are passed back to main as character strings from the .DLL. The data module is loaded and maninpulated within the .DLL routines.

I think you were referring to direct access to shared data in the data module.

Is that correct?

Norm

27 Sep 2009 6:18 #5051

Yes that is correct.

27 Sep 2009 11:22 #5052

Thanks Paul

I'll have to go away and think about it ... something is not quite working when I use the additional compiler flags as I try to emulate the command line approach in FTN95.

In FTN95 when I compile the data module file itself, I use /ZEROISE /BINARY flags ...

And, in FTN95 when I compile the other programmes for the .DLL, I use a batch file with the line: ftn95 /OPTIMISE /ZEROISE /FIXED_FORMAT %1 /MOD_PATH ..\MODULES

The final command sequence for creating the .DLL is to type on the DOS command line, SLINK setup_dll.lnk, where the .lnk file contains the commands:

dll lo *.obj lo d:\stclair_core\irisk_online\programmes\modules\irisk_online.obj subsystem windows exportall file irisk

Noting that the data module, irisk_online.obj is added separately to the .DLL.

It is mapping this process to the .NET Visual Studio that is giving me problems.

In Visual Studio, I note that I included the data module .F95 programme in the SOURCE FILES. Should this be compiled separately then added in later in the process?

Your help is much appreciated.

Regards

Norm

28 Sep 2009 1:11 #5055

G'Day Paul

Followed instruction and copied .MOD file that was created when .DLL was created successfully. It seems that .NET compiles the MODULE correctly and creates the .MOD file within the project.

I copied the .MOD file to the new project that is to test the .DLL rather than use the /MOD_PATH flag.

I then BUILD the test project with 1 main programme and references to the new .DLL as well as the SLAFLIBC and FTN95LIB.

I get a new error on compilation concerning 'more than one source file specified with names' ...:

here is the output from the buildlog.txt file.

Compiling file: FixedFormat1.for FTN95.EXE 'D:\STCLAIR_CORE\irisk_net\test_irisk\test_irisk\FixedFormat1.for' /NO_BANNER /DEBUG /FULL_DEBUG /IMPLICIT_NONE /MOD_PATH /MOD_PATH D:\STCLAIR_CORE\irisk_net\test_irisk\test_irisk /STANDARD_ERROR_REPORTS /SINGLE_THREADED /FPP /CLR /CLR_VER 2 /REF 'C:\Program Files\Silverfrost\FTN95\redist\ftn95lib.dll' /REF 'C:\Program Files\Silverfrost\FTN95\redist\salflibc.dll' /REF 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll' /REF 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll' /REF 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll' /REF 'D:\STCLAIR_CORE\irisk_net\test_dll_build\test_dll_build\Debug\NET\test_dll_build.dll' /VS8 /DELETE_OBJ_ON_ERROR /ERROR_NUMBERS /UNLIMITED_ERRORS /BINARY 'Debug\NET\FixedFormat1.dbk'

Compiler output: *** More than one source file specified with names D:\STCLAIR_CORE\irisk_net\test_irisk\test_irisk\FixedFormat1.for and D:\STCLAIR_CORE\irisk_net\test_irisk\test_irisk 1 ERROR [D:\STCLAIR_CORE\irisk_net\test_irisk\test_irisk\FixedFormat1.for FTN95 5.20.0] - Compilation failed.

There were compile errors, no link performed

test_irisk build failed.

This seems simple to fix ... but it hasn't been .... any thoughts.

Norm

28 Sep 2009 8:14 #5058

This is probably a linker failure report. Are you using Visual Studio or your own command line? Can you look at the command line being issued? You can get this in VS and Plato. If this does not show anything wrong then create a MAP file for the linker and have a look at that.

Please login to reply.