[R-pkg-devel] MAX_ARGS limitation in foreign function calls

2018-02-20 Thread Udaya B. Kogalur
We are hitting the MAX_ARGS ceiling in our R-C function calls in the
development of randomForestSRC.  This limits to number of arguments to
65 using .Call().  Is there a work around for this dilemma?  Thank
you.

Udaya B. Kogalur

u...@kogalur.com
Website:  www.kogalur.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] MAX_ARGS limitation in foreign function calls

2018-02-20 Thread Dirk Eddelbuettel

On 20 February 2018 at 09:33, Udaya B. Kogalur wrote:
| We are hitting the MAX_ARGS ceiling in our R-C function calls in the
| development of randomForestSRC.  This limits to number of arguments to
| 65 using .Call().  Is there a work around for this dilemma?  Thank
| you.

The easiest is to avoid the problem by using one or more of your SEXP objects
as lists and simply nest other arguments inside the list object.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] header file for "flockfile" function under windows

2018-02-20 Thread Carmen M. Livi
Hi all,

I am using file-locking functions in C that can be found in the 
 in Unix

extern void flockfile (FILE *__stream) __THROW;
extern int ftrylockfile (FILE *__stream) __THROW __wur;
extern void funlockfile (FILE *__stream) __THROW;

When submitting to CRAN I have troubles with the win-builder.

 in windows does not contain those functions. But I found them 
in the .
But even when including all possible header files for pthread like:*
*

*#include **#include *
*#include #include #include 
#include #include *

I am aways getting the same error from win-builder:

bed2vector.cpp:2667:19: error: 'flockfile' was not declared in this scope
flockfile(stream);
^
bed2vector.cpp:2670:46: error: 'getc_unlocked' was not declared in this scope
for (int ch = 0; (ch = getc_unlocked(stream)) != EOF;) {
   ^
bed2vector.cpp:2678:27: error: 'funlockfile' was not declared in this scope
  funlockfile(stream);
^
bed2vector.cpp:2694:21: error: 'funlockfile' was not declared in this scope
funlockfile(stream);
  ^

So the header files are there, but the functions are not defined. I am 
not an expert in C, but
have to submit a package that uses C-code. Does someone have more 
experience with this?

Thanks,
Carmen


On 19/02/2018 15:22, Mauro Donadello wrote:
> Prova ad aggiungere
>
> #include 
> #include 
>
>
>> On 19 Feb 2018, at 15:07, Carmen M. Livi  wrote:
>>
>> Ciao Mauro,
>> Posso disturbarti un secondo di pomeriggio e scendere un attimo? Ho un 
>> problema con C... cioe' io e linux no, ma Windows.
>> Sulle nostre macchine compila senza problemi ma su Windows mi da un errore.
>>
>> Lancio il seguente commando:
>> g++ -m64 -std=gnu++11 -I"/lustre/home/clivi/programs/R-devel/include" 
>> -DNDEBUG  -I"/lustre/home/clivi/programs/R-devel/library/Rcpp/include/" 
>> -I"/lustre/home/clivi/programs/R-devel/library/BH/include/"   
>> -I"/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include"  -I./ -D_FASTMAP 
>> -DMAQ_LONGREADS -lbz2 -O2 -Wall  -mtune=core2 -c bed2vector.cpp -o 
>> bed2vector.o
>> Allegato il codice da eseguire.
>>
>> l messaggio di errore:
>> * installing *source* package 'spp' ...
>> ** libs
>> Warning: this package has a non-empty 'configure.win' file,
>> so building only the main architecture
>>
>> d:/Compiler/gcc-4.9.3/mingw_64/bin/g++ -m64 -std=gnu++11 
>> -I"D:/RCompile/recent/R-3.4.3/include" -DNDEBUG  
>> -I"d:/RCompile/CRANpkg/lib/3.4/Rcpp/include" 
>> -I"d:/RCompile/CRANpkg/lib/3.4/BH/include"   
>> -I"d:/Compiler/gcc-4.9.3/local330/include"  -I./ -D_FASTMAP -DMAQ_LONGREADS 
>> -lbz2 -O2 -Wall  -mtune=core2 -c bed2vector.cpp -o bed2vector.o
>> In file included from D:/RCompile/recent/R-3.4.3/include/Rdefines.h:37:0,
>>   from bed2vector.cpp:22:
>> D:/RCompile/recent/R-3.4.3/include/R_ext/RS.h:55:0: warning: "ERROR" 
>> redefined
>>   #define ERROR   ),error(R_problem_buf);}
>>   ^
>> In file included from 
>> D:/Compiler/gcc-4.9.3/mingw_64/x86_64-w64-mingw32/include/windows.h:71:0,
>>   from d:/Compiler/gcc-4.9.3/local330/include/bzlib.h:79,
>>   from bed2vector.cpp:15:
>> D:/Compiler/gcc-4.9.3/mingw_64/x86_64-w64-mingw32/include/wingdi.h:75:0: 
>> note: this is the location of the previous definition
>>   #define ERROR 0
>>   ^
>> bed2vector.cpp: In function 'int get_bzline(BZFILE*, std::string&)':
>> bed2vector.cpp:48:11: warning: variable 'nBuf' set but not used 
>> [-Wunused-but-set-variable]
>> int nBuf;
>> ^
>> bed2vector.cpp: In function 'SEXPREC* read_eland_mismatches(SEXP)':
>> bed2vector.cpp:654:11: warning: variable 'nm' set but not used 
>> [-Wunused-but-set-variable]
>> int nm=0;
>> ^
>> bed2vector.cpp: In function 'SEXPREC* read_eland_extended(SEXP, SEXP, SEXP)':
>> bed2vector.cpp:1074:20: warning: comparison between signed and unsigned 
>> integer expressions [-Wsign-compare]
>> for(int i=0;i>  ^
>> bed2vector.cpp: In function 'ssize_t getline_local(char**, size_t*, FILE*)':
>> bed2vector.cpp:2659:19:
>> error
>> : 'flockfile' was not declared in this scope
>> flockfile(stream);
>> ^
>> bed2vector.cpp:2662:46:
>> error
>> : 'getc_unlocked' was not declared in this scope
>> for (int ch = 0; (ch = getc_unlocked(stream)) != EOF;) {
>>^
>> bed2vector.cpp:2670:27:
>> error
>> : 'funlockfile' was not declared in this scope
>>   funlockfile(stream);
>> ^
>> bed2vector.cpp:2686:21:
>> error:
>>   'funlockfile' was not declared in this scope
>> funlockfile(stream);
>>   ^
>> make: *** [bed2vector.o] Error 1
>> Warning: running command 'make -f "Makevars.win" -f 
>> "D:/RCompile/recent/R-3.4.3/etc/x64/Makeconf" -f 
>> "D:/RCompile/recent/R-3.4.3/etc/x64/Makevars.site" -f 
>> "D:/RCompile/recent/R-3.4.3/sh