Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Mixed Language examples

DCooper
Beginner
720 Views

I have been given the task of creating a Fortran dll and linking it to a VB.Net.

I have down loaded and installed

- Visual Studio 2022 (64 bit) ver. 17.14.16 

- Intel oneAPI-HPC-toolkit 2025.2.1.46

- down loaded ipsx2019-samples-win-20190321.zip

Windows 10 pro

I extracted the MixedLanguage example VB_Calls-Fortran

 

When I try to load the solution I first get a message to upgrade to 4.8 framework because the solution framework is no longer supported. Upgrade seems to work.

 

When I try to build the solution I get an error saying that 32 bit is not supported in ifx.

I change both the fortran and vb projects to 64 bit debug.

Everything seems to compile correctly but when I try to run the program without debug I get an exception unhandled message  -- Unable to load DLL 'FCALL.DLL':  The specified module could not be found. -- on line 179 of the Form1.vb code. (Call DLL_ROUT(DBL_IN, MULTIPLIER, DBL_OUT)

I have checked and FCALL.Dll is in the 'VBCallsFortran/bin/debug/' directory along with the VBCallsFortran.exe.

Can someone tell me where I went wrong or do you have an simple example similar to this which works with Visual Studio 2022 and the current ifx.

 

Thanks in advance

David Cooper

 

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
671 Views

>>but when I try to run the program without debug

Is this from within MS VS or outside MS VS?

 

If when running the program outside of MS VS then the path to the DLL is not found.

To correct this, either place the DLL in the same folder as the *.exe

.OR.

Register the DLL see this.

Something like

cd \VBCallsFortran/bin/debug
regsvr32 /s FCALL.DLL

jimdempseyatthecove_0-1759582369159.png

When switching to release mode, unregister the debug FCALL.DLL and then register the release FCALL.DLL (which presumably will be located within your distribution directory).

 

Jim Dempsey

 

0 Kudos
MWind2
New Contributor III
604 Views

I started from scratch and it may be useful.

0 Kudos
MWind2
New Contributor III
595 Views

I changed the validation to within BtnAdd and got rid of KeyDown-enter validation in Form1.vb

0 Kudos
MWind2
New Contributor III
582 Views

Also, 

Debug > Options > Debugging > General and uncheck "Enable Just My Code." This allows the debugger to step into external code, including your DLL.
Enable mixed-mode debugging by going to the project's Properties > Debug and selecting "Enable native code debugging"

0 Kudos
Reply