ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

How to close a Fortran DLL routine when exiting Visual Basic (front-end) program

<< < (3/5) > >>

OptimalDesigns:
Try running the app's demos and see what is going on.  Many runs and all is well.  Then try exiting the app.  It hangs!  Many DLLs show a wx_close() or w?_close() routine that does the job.  But out of my range.

KodeZwerg:
Hello Phil,

with Delphi there happen no error (okay i cannot argue with that dll correct since i absolutely have no idea what you are doing there at all, some kind of calculation happen and a file is generated).

So i've tried to analyze your main executable. Running with two different debuggers = no real result.
Problem is that VB generate strange code, very hard to debug for me. I get alot of floating calculation errors even before the main executable is loading dll.

From my point of view the problem is somewhere in VB main executable and not DLL.
I have same result, closing App wihtout using DLL = no Problem, running DLL once = App crash on exit.

Please go through this checklist: (i hope VB code is same like other languages)
every "Open" needs a "Close", every "Create" needs a "Free", every "Allocate" needs a "DeAllocate", every "Attach" might need to be "Dettached" and so on.
Take a close look with everything that happen inside VB when DLL is used (ie: generate a picture, allocate stuff to do that, create image etc) and if you really "close/finalize" everything what was used during DLL interaction.

I am sorry if my english is bad/hard to read, but i hope you know what i try telling.

KodeZwerg:
Please do me a favor, create a new VB Project, just include a Button and do a fake DLL call. (fake = just fill parameter with something to be able to start that function)

Does that sample Application hang too?

This way you can verify if it is VB code in main Project (what my feeling tell that there is something wrong) or if VB has a generic problem with that DLL at all.

wraith808:
So you tried using the DLL in Delphi and calling functions and it unloaded correctly?  Where you dynamically loading the DLL or did you statically link it?

KodeZwerg:
So you tried using the DLL in Delphi and calling functions and it unloaded correctly?  Where you dynamically loading the DLL or did you statically link it?
-wraith808 (July 22, 2018, 11:52 AM)
--- End quote ---
Static, unloads without error on Application Close.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version