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

How to disable "Entry point not found" popup in console application

Sebastian_H
Beginner
790 Views

In my 32-bit fortran 95 console application, I use the "LoadLibraryEx" function from the kernel32 module to load a dll file. The code compiles without problems. However, if the loaded dll file is not the intended one (e.g. it is linked with different static libraries than my console application), then there is a popup message "Entry point not found" which requests my consent by clicking the "ok" button before the "LoadLibraryEx" function returns with a zero handle.

As I would like to run the console application as a part of an automated process, is there a way (compiler flag or the like) to avoid this message window? To my application, the returned zero handle is sufficient to decide what to do with the unintended dll file.  

I am using ifort and link on Windows 10.

0 Kudos
1 Solution
andrew_4619
Honored Contributor II
782 Views

To enable or disable error messages displayed by the loader during DLL loads, use the SetErrorMode function.

Actually that applies to LOADLIBRARY not the EX version the answer you want is probably in the dwflags options....

 

View solution in original post

0 Kudos
7 Replies
andrew_4619
Honored Contributor II
783 Views

To enable or disable error messages displayed by the loader during DLL loads, use the SetErrorMode function.

Actually that applies to LOADLIBRARY not the EX version the answer you want is probably in the dwflags options....

 

0 Kudos
JohnNichols
Valued Contributor III
770 Views

As Andrew suggested trap you are going to need to trap in some form the error message. 

https://titanwolf.org/Network/Articles/Article?AID=af83b541-434a-435f-a5ef-725eb3edf987#gsc.tab=0 

 

Another suggestion is to go the LISP route, use a main program - launch the DLL loader as a thread and watch the thread, if it does not return after a set time you have trapped the error and can handle the thread.  I use watcher programs all over the world to catch errors in far distant computers and restart the process or if required the computer.  

There are lots of things you could do with a watcher program  - open a file and keep incrementing the time and check it -- I have one watcher program that has worked perfectly for four years and last week it threw an error I had never thought of in all my short brutal life.  

0 Kudos
Sebastian_H
Beginner
762 Views

John, this is probably a good way to resolve issues more systematically in the future. I am just learning about all the features that fortran 95 and 03 have to offer - and did not yet venture into multi-threading. Thank you very much for the inspiration.   

0 Kudos
Sebastian_H
Beginner
764 Views

Thanks Andrew, I was not aware of that function and was fiddling around with the dwflags in order to get the desired behavior. So, with your suggestion I run the SetErrorMode(uMode) with uMode=Z"0001" and call the LoadLibrary function afterwards. Thanks again for this easy fix!

0 Kudos
Sebastian_H
Beginner
760 Views

Thanks Andrew, I was not aware of that function and was fiddling around with the dwflags in order to get the desired behavior. So, with your suggestion I run the SetErrorMode(uMode) with uMode=Z"0001" and call the LoadLibrary function afterwards. Thanks again for this easy fix!

P.S. : By the way, SetErrorMode also works in combination with LoadLibraryEx. 

 

0 Kudos
JohnNichols
Valued Contributor III
740 Views

The interesting problem is the core of a computer is the most wasted device in the world beside the modern motorcar.   Most programs putter along on one core and the other three to 33 stand idle.  If we did this with ditch diggers everybody would scream out loud, but this is hidden.  Setting aside the horrendous issue of wasted mothers sitting at home minding children who should be in preschool learning.  It is called GPD.

Once you upload the analysis to the cloud and start to pay for every cycle you suddenly look at those wasted cycles on your NUC in a new light and go on - let me see.  

Your only real issue is using a database to store the intermediate analysis results and then you can at your leisure look at the results, compared to hundreds of hours of analysis that you pay for on stored data.

If I do a data collection every 8 seconds, in one thread, I can do an awful lot of analysis is the other three on that data in the next eight seconds and upload it to the cloud - after a day I have 10000 data points, some of the most advanced engineering theories in the 20th century were built on tens of data points.  Now, it is not the engineer who sees a thread in a gentle stream of data, but the engineer who looks at the Niagara Falls and sees a thread.  A student's t test with 10,000 data points is quite accurate.  Most papers published today are old school. 

If you are going to do this - you are likely doing it in C or Fortran, you read this forum or equivalent and you have the Titans on speed dial. 

There is a famous story from management analysis, a team went into the Watson lab to improve the human interactions, common in the 80's , they went through the building and dissected everyone's work to work out how to make it more efficient, at the end they said - we understand everyone except the guy on the ground floor in the corner, he sits in his office and his secretary stopped us from talking to him. 

The big boss said to the team as I remember the paper, he solves the problems no one else can solve, leave him alone he is worth tens of millions of dollars every year.  I knew a guy like that at Newcastle Uni and they fired him, I have never ever seen such stupidity.  One of my junior engineers once screamed about me at the Chief Draughtsman -- how does he do it - Nev responded - he just sees things you do not see, as does Fortran Fan, Steve, Jim, and mecej4 for the things I cannot see.  We are all blind in some dimensions, except mecej4, he is not. 

0 Kudos
JohnNichols
Valued Contributor III
738 Views

Steve sees in infinite dimensions and Jim and FF see all. 

0 Kudos
Reply