I have been able to create and use a 'Win32' dll with EXPORTALL set in Project-->Properties-->Linker Options.
However, how I do not see how to do that with a .NET dll project. How do I set EXPORTALL for a .NET dll in Visual Studio?
Welcome to our forums
I have been able to create and use a 'Win32' dll with EXPORTALL set in Project-->Properties-->Linker Options.
However, how I do not see how to do that with a .NET dll project. How do I set EXPORTALL for a .NET dll in Visual Studio?
Everything is exported anyway. There is no switch because the attribute cannot be switched off.
If you were writing C# code then you could make your fucntions private or public. In .NET FTN95 all external routines are public
Well, unfortunately I must be missing something, I am not getting anything exportable. When I run the vb.net code calling the .NET FTN95 dll it gives the following error message when accessing the Fortran function:
'EntryPointNotFoundException was unhandled'
I am using the same code from the help file. Again, it worked for the Win32 dll, but not for .NET FTN95 dll
When I use the trial version of 'Anywhere PE Viewer' it shows the following:
C:\WINDOWS\F95Net.dll The image does not export any functions
For the Win32 dll it shows the following: C:\WINDOWS\F95.dll Export table F (Ordinal: 1, Entry Point RVA: 1000h (4,096))
Here is the Fortran code used in both:
F_STDCALL FUNCTION F(X)
INTEGER F,X
F=X
END
and here is the vb.net code
Public Class Form1
Private Declare Function F Lib 'F95Net.dll' (ByRef lnr As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As Integer
x = F(3)
TextBox1.Text = CStr(x)
End Sub
End Class
Here is the buildlog.txt output, I tired for both .NET 2.0 and 3.5:
/////////////////////////////////////
Build log for project: F95Net Configuration: Debug/.NET Date: 3/3/2010 - 09:49:13
/////////////////////////////////////
System Configuration ////////////////////
Path Directories: C:\Program Files\Silverfrost\FTN95 C:\Program Files\Pervasive Software\PSQL\bin\C:\WINDOWS\system32 C:\WINDOWS C:\WINDOWS\System32\Wbem C:\MSDEV\BIN C:\Program Files\Perforce\C:\Program Files\jZip C:\Program Files\Intel\WiFi\bin\C:\Program Files\IDM Computer Solutions\UltraEdit-32 C:\Program Files\Windows Imaging\C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin C:\Program Files\Microsoft Visual Studio\Common\Tools C:\Program Files\Microsoft Visual Studio\VC98\bin
Project Directory: C:\F95Net\F95Net\Output Directory: C:\F95Net\F95Net\Debug\NET Output File: Debug\NET\F95Net.dll
Project Build /////////////
C:\F95Net\F95Net\FreeFormat1.f95
Compiling...
Compiling file: FreeFormat1.f95 FTN95.EXE 'C:\F95Net\F95Net\FreeFormat1.f95' /NO_BANNER /DEBUG /FULL_DEBUG /STANDARD_ERROR_REPORTS /SINGLE_THREADED /FPP /CLR /CLR_VER 2 /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' /VS8 /DELETE_OBJ_ON_ERROR /ERROR_NUMBERS /UNLIMITED_ERRORS /BINARY 'Debug\NET\FreeFormat1.dbk'
Linking...
Command line for link: dbk_link2.exe /VS7 /NO_BANNER /REF:'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll';'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll';'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll' 'Debug\NET\F95Net.dll' @'C:\F95Net\F95Net\link.lst' Linker output: Assembly file Debug\NET\F95Net.dll for .NET 2.0 produced
F95Net build succeeded.
/////////////////////////////////////
Ok, I found the solution in the help file. Wow, it was really hidden under Visual ClearWin-->Getting Started. There you will find a link to a BEAUTIFUL sample called 'Calling Fortran from .NET - A Simple C# Form'.
It should really be called 'Calling FTN95 .NET dll from .NET - A Simple C# Form'
Anyway, this is perfect, and should be easier to find.