January 17, 2011

Azghar Azghar
Lab Rat
2 posts

[Solved] Load Fortran DLL (Microsoft Digital Visual Fortran)

 

Hi,

Please help me… This is very urgent !!!

I have create a fortran DLL using Microsoft Digital Visual Fortran Studio. I am trying to load DLL in my Qt application and DLL is not loading… Below is my code

  1.  QString libPath(QString(QApplication::applicationDirPath() + QDir::separator() + "final.dll"));
  2.  QLibrary myLib(libPath);
  3.  bool okLoad = myLib.load(); // check load DLL file successful or not
  4.  bool ok = myLib.isLoaded(); // check is DLL file loaded or not
  5.  
  6.  typedef void (*FINAL)();
  7.  FINAL mFINAL = (FINAL) myLib.resolve("FINAL");
  8.  if (mFINAL)
  9.  {
  10.   int c = 0;
  11.   FINAL();
  12.  }
  13.  myLib.unload();

when I run above code … myLib.load() is returning false

Please let me know if Qt is compatible with DLL created with Microsoft Digital Visual Fortran Studio.

thanks in advance,
Azghar

EDIT (Gerolf) sourounded code by tags

2 replies

January 17, 2011

Gerolf Gerolf
Area 51 Engineer
3211 posts

Have you check, if there is some debug output when you call myLib.load()?
Have you checked with dependecy walker, if all libs that are needed are available?
Which compiler do you use?

By the way, Please sourround code by @ tags.

EDIT:

in general, it should not be a Qt issue, as Qt is just a set of libaries, you load to your C++ code.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

January 17, 2011

Azghar Azghar
Lab Rat
2 posts

Hi Gerolf,

Thanks a lot for help. I used dependency walker and found that DFORRT.DLL was missing. I copied this DLL to System 32 directory. Now I am able to load DLL and run function.

thanks,
Azghar

 
  ‹‹ [Moved] Include files      [Moved] Wierd ISO C++ forbids delaration with no type error ››

You must log in to post a reply. Not a member yet? Register here!