- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
INTEGER(4) FUNCTION DUMMY(X)
!DEC$ ATTRIBUTES DLLEXPORT :: dummy
REAL(8) X
DUMMY = NINT(X)
RETURN
END FUNCTION DUMMY
This compiles and links fine as shown here:
C:\\projects\\GEWind\\loaddll>ifort -dll myfunc.f90
Intel Visual Fortran Intel 64 Compiler XE for applications running
on Intel 64, Version 12.0.4.196 Build 20110427
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
-out:myfunc.dll
-dll
-implib:myfunc.lib
myfunc.obj
Creating library myfunc.lib and object myfunc.exp
I then built a trivial program to test the loading of a DLL:
PROGRAM testload
USE IFWIN
!DEC$ ATTRIBUTES DLLIMPORT :: dummy
! check to learn how to load and use a dll
INTEGER(HANDLE) dllhandle, ires
dllhandle = LoadLibrary('myfunc.dll'C)
write (*,*) ' DLL handle = ', dllhandle
END PROGRAM testload
This also compiles and links without a peep:
C:\\projects\\GEWind\\loaddll>ifort testload.f90
Intel Visual Fortran Intel 64 Compiler XE for applications running on
Intel 64, Version 12.0.4.196 Build 20110427
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
-out:testload.exe
-subsystem:console
testload.obj
Running testload, however, returns 0 for dllhandle and brings up a runtime error box:
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.
I can't figure out where the problem is. Anyone able to help?
Additional info: OS=Win7 pro, SP1, 64-bit
Visual Studio 2008, v9.0.21011.8 RTM
Fortran as shown above
Also tried it without the C qualifier on the file name - same results.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What does Dependency Walker say?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. depends gives a loading error. I am attaching the screen output, which seems to support your idea that mixed up DLLs are being referenced, but I am not sure how, since I am working from the command line and I did a full uninstall/reinstall of VS2008 and the compiler last Firday. There is no local copy of msvcr90.dll.
Andy Elliott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I recommend anyone else with similar problems also refer to that sample.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page