gstlearn / gstlearn

The Geostatistics & Machine Learning C++ Library
Other
19 stars 2 forks source link

gstlearn documentation and a problem in MSVC 2022 (windows 11) #111

Closed jbensabat closed 8 months ago

jbensabat commented 11 months ago

Hello I have built the lib and I am now trying to run the examples. Some of them are obvious but others are more complex. Is there documentation available on gstlearn ? about what it does and how it is organized, ?

also, running the examples can lead to exceptions which occur in the following function

/**

under windows _open_osfhandle returns a negative value thus creating an exception in _fdopen I just placed a condition on the value of fd

best jac

fabien-ors commented 10 months ago

Thank you for reporting. Documentation is still (always ^^) under development. But you can find tutorials, courses and API description on the official website: https://gstlearn.org

To have a first overview of what gstlearn provides, I suggest you to read our courses: https://gstlearn.org/?page_id=193

All what is available in python or R is available in C++. The API available is described through doxygen HTML files: https://gstlearn.org/?page_id=91

jbensabat commented 10 months ago

hi thanks a lot jac

fabien-ors commented 8 months ago

@jbensabat : Please, could you provide me a reproducible example that leads to the exception you are talking about ? I never experienced this exception with my windows (Visual or MinGW). I have done a small fix in 49298c9 to prevent calling "stop" method when the redirection is not active, but all of our tests use an active redirection. Thank you for your help.

jbensabat commented 8 months ago

Good morning I compiled the lib and examples with MSVC2022/64bit we got the same exception for every example we ran (we did not run all the examples though) I solved the problem transforming the stop() method namely, you call int fd = _open_osfhandle((intptr_t)_old_stdout, _O_WRONLY | _O_TEXT); what I have seen is that I got fd=-1, which caused the exception when calling _fdopen(fd,.. best jac

void StdoutRedirect::stop() {

if defined(_WIN32) || defined(_WIN64)

// https://stackoverflow.com/questions/32185512/output-to-console-from-a-win32-gui-application-on-windows-10 if (_old_stdout) { SetStdHandle(STD_OUTPUT_HANDLE, _old_stdout); int fd = _open_osfhandle((intptr_t)_old_stdout, _O_WRONLY | _O_TEXT); **if (fd >= 0) { FILE fp = _fdopen(fd, "w"); freopen_s(&fp, "CONOUT$", "w", stdout); } }

else

std::cout.rdbuf(_coutbuf);** _out.close();

endif

}

fabien-ors commented 8 months ago

Fixed in v1.1.0