From didier.renard at ensmp.fr  Fri Feb  3 08:25:00 2006
From: didier.renard at ensmp.fr (Renard Didier)
Date: Fri, 03 Feb 2006 08:25:00 +0100
Subject: [Rd] Interfacing C-code (gets and printf) under WINDOWS (Visual C++)
Message-ID: <43E3054C.5020600@ensmp.fr>

Hi

I try to develop a R interface to a set of C routines, in order to 
produce a R-package on Geostatistics.
My C-code uses interaction with the user as I use printf and gets 
statements.
I develop the code in a LINUX environment and do not face any problem 
having the questions and answers routed on my current Terminal.
When I tried to port the package on Windows, the problems began. No 
message was routed to the Console and I could not enter any answer. Let 
me first admit that I am not a specialist of the WINDOWS environment.
I started looking for an answer on the WEB and intercepted some pieces 
of answers ... but I did not succeed in getting a workable solution. 
This is the reason why I put this open question here today.

I did not find lots of information about the gets solution. Finally, I 
have chosen to use R_WriteConsole and R_ReadConsole which seemed to be 
promising solutions. I discovered an information saying that starting 
R-2.0.1, the include file R-interface.h could help me. This is the 
reason why I downloaded the latest version available on the R site 
(R-2.2.1). Unfortunately, I did not find such a file in the include 
directory. Moreover, in Visual C++ that I am using for building my DLL, 
I need to find the LIBRARY containing the objects of these two routines.
Did I do something wrong. Do I need to download other contributions 
first. Do I use incorrect routines ?

Thank you for your help.

Didier RENARD



[Rd] Interfacing C-code (gets and printf) under WINDOWS (Visual C++)
Renard Didier