Page 1 of 1

Accessing a dll (Part 2)

Posted: 22 Feb 2013 17:07
by kingchris
This is a previous message that spoke about this problem.
http://discuss.visual-prolog.com/viewtopic.php?t=6392

I am adding my own bindings to the FANN DLL library and come across the old problem of how to put debug statements in the DLL runtime that would actually print somewhere meaningful.

So far this is what I have manged to do.
In the DLL code which I am compiling as 'C' code in VS2008 I have placed the following code

Code: Select all

        BOOL Fred= AllocConsole();         freopen("CONIN$","r",stdin);         freopen("CONOUT$","w",stdout);         freopen("CONOUT$","w",stderr);
I have put this code into the fann_create_standard_array function as this is the first function that I try and call. Later I might add a init_debug_output function as a temporary extension to the FANN lib Prolog bindings where this code will sit.

Statement like fprintf(stderr,"Error No. %d\n",errno); now produce output to an extra console screen that appears as well as your GUI interface from the FANNTest.exe that I am using to test interface to FANN. Still having floating point issues but at least I can now put debug statements anywhere I want and have them printout to the Console window.

There is no question here. This is just info for any who need it.