![]() I realized that the freezing has nothing to do with files. With this set up the program was having the problems I mentioned in original post. Since Function 8 uses a function from MathRoutines.dll, I need to load it when called directly. This is because I will be using the dll in my C# interface program where function8 will be called directly. In Function8 I had an if block to load the Mathroutines dll. WBTemperature = BisectionRootFinder(WBTempLo,WBTempHi,RelHumidity,0.0005,Params,50,RelHumidityfn_WB_Params) Īs you will notice the said dll references another dll "MathRoutines.dll" to do a calculation. SpVOL = SpecVolumefn_DB_WB_Pressure(DB,WB,Pressure) ĮNTH = Enthalpyfn_DB_WB_Pressure(DB,WB,Pressure) ĭouble DLL_EXPORT _cdecl Function8(double DBTemperature, double RelHumidity, double Pressure,int LoadLibraryFlag) // RH = RelHumidityfn_DB_WB_Pressure(DB,WB,Pressure) ĭP = DewPointTempfn_DB_WB_Pressure(DB,WB,Pressure) HR = HumRatfn_DB_WB_Pressure(DB,WB,Pressure) WB = WBTempfn_DB_RH_Pressure(DB,RH,Pressure,1) RH = RelHumidityfn_DB_HumRat_Pressure(DB,HR,Pressure) HR = HumRatfn_DB_Enthalpy_Pressure(DB,ENTH,Pressure) ![]() MathRoutinesInstance = LoadLibrary("./MathRoutines.dll") īisectionRootFinder = (fp_BisectionRootFinderTYPE) GetProcAddress(MathRoutinesInstance,"BisectionRootFinder") Typedef double (_cdecl *fp_BisectionRootFinderTYPE) (double, double, double, double, double*, int, double(*)(double,double*)) Įxtern fp_BisectionRootFinderTYPE BisectionRootFinder įp_BisectionRootFinderTYPE BisectionRootFinder ĭouble DLL_EXPORT _cdecl *CalcAirProperties(int InputCombination, double Input1, double Input2, double Pressure)ġ: Given DB, WB and Pressure Ĥ: Given DB, DP and Pressure * To use this exported function of dll, include this headerĭouble DLL_EXPORT _cdecl *Function1(int InputCombination, double Input1, double Input2, double Pressure) ĭouble DLL_EXPORT _cdecl Function2(double DBTemperature, double WBTemperature, double Pressure) ĭouble DLL_EXPORT _cdecl Function3(double DBTemperature, double WBTemperature, double Pressure) ĭouble DLL_EXPORT _cdecl Function4(double DBTemperature, double WBTemperature, double Pressure) ĭouble DLL_EXPORT _cdecl Function5(double DBTemperature, double WBTemperature, double Pressure) ĭouble DLL_EXPORT _cdecl Function6(double DBTemperature, double WBTemperature, double Pressure) ĭouble DLL_EXPORT _cdecl Function7(double DBTemperature, double WBTemperature, double Pressure) ĭouble DLL_EXPORT _cdecl Function8(double DBTemperature, double RelHumidity, double Pressure,int LoadLibraryFlag=1) ĭouble DLL_EXPORT _cdecl Function9(double DBTemperature, double HumRatio, double Pressure) ĭouble DLL_EXPORT _cdecl Function10(double DBTemperature, double Enthalpy, double Pressure) So to understand it better I put my CPP header and the source file here: However I do not know the reason it solved. I tried creating a small working example as asked in the comments and while doing that I solved the issue. I can try to make a simple program which demonstrates the issue if it is needed.Īny ideas/help/suggestion is much appreciated. I thought it could be a problem with the debug version, so I changed the project to options to no include debug variables, but the problem persists. Is it a process of bad memory management? Is it something to do with how the C++ pointer and Fortran pointer is handled? I am really lost what is the problem here. Then I repeat the above process and sometimes that would bring the application back to life. It might run a few times and randomly it will freeze. I deleted the output files created by the application & gmon.out, then double clicked the executable and voila, the program runs again. I tried multiple times and every time that happened. ![]() I had to go to Task Manager and kill the program. However, when I double click the application executable to see what such a launch would do, it was not responding. The application builds without any problem and runs under debug mode. ![]() On the C++ side, I am using gcc and code::Blocks. I am using gfortran to compile Fortran and the Simply Fortran IDE. Reads from an XML file and writes outputs to an XML file, and two text files. I convert the C++ array pointer to Fortran pointer using the intrinsic method c_f_pointer ![]() Interfaces with a C++ dll which returns a pointer to an array of doubles. Uses ALLOCATABLE Data structures to hold information Here are some details about my application: I am having a strange problem with my Fortran program. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |