- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have created a Fortran DLL under VS2008 in WinXp, and i want to call it from VC++ under VS2008 in Win7 .
But there is a problem: This DLL can not be loaded sucessfully in Win7 machine. The loading funcation used in VC is "Loadlibrary".
Can you help me ?
Thank you.
Jiang Cheng
But there is a problem: This DLL can not be loaded sucessfully in Win7 machine. The loading funcation used in VC is "Loadlibrary".
Can you help me ?
Thank you.
Jiang Cheng
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please report the versions of the OS and compilers in full detail, and state whether the DLL in question is 32-bit or 64 bit, and whether the program that fails to load the DLL on Win7 is 32-bit or 64-bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to use a Fortran DLL on a system where the same version of Visual Studio and Visual Fortran is not installed, you need to install "redistributables" on the target system. You can get the Fortran redistributable from here - you want the .msi ("package"). Install this on the target system and see if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OS is Win7 64bit and the DLL was created in XP 32bit. The program that fails to load the dll is on Win7 64bit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Doesn't matter. By default, your Fortran DLL is built against DLL libraries so it has DLL dependencies. You can also try changing the "Use run-time library" setting to "Multithreaded" instead of "Multithreaded DLL", but if you're calling from C/C++ I generally recommend against that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when you say 'fails to load' what error message do you get?
I have not encountered any issues with linking C++ programs with Fortran DLL's from update 3.
can it not find the DLL? (which would be a directory issue)
or does a specific error occur?
be sure to copy the files, or specify the same directory for the build targets, or use
$(SolutionDir)$(ConfigurationName)
as target location for C++ and Fortran in the Solution.
brian
I have not encountered any issues with linking C++ programs with Fortran DLL's from update 3.
can it not find the DLL? (which would be a directory issue)
or does a specific error occur?
be sure to copy the files, or specify the same directory for the build targets, or use
$(SolutionDir)$(ConfigurationName)
as target location for C++ and Fortran in the Solution.
brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used "Loadlibrary" to load the DLL and the returned Hinstance is emety when it fails to load.
I am sure that the directory is right.
Is there any possibility of the uncompatible between the 64bit and the 32bit? Because the DLL was created on
32bit platform and loading DLL was occurred on 64bit platform.
thanks a lot
I am sure that the directory is right.
Is there any possibility of the uncompatible between the 64bit and the 32bit? Because the DLL was created on
32bit platform and loading DLL was occurred on 64bit platform.
thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have tried but still exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you building a 64 or 32 bit application ?
You cannot mix 32 and 64 bit - as far as I know
So if your application is 64 bit, then you cannot load a 32 bit dll
You cannot mix 32 and 64 bit - as far as I know
So if your application is 64 bit, then you cannot load a 32 bit dll

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