Displaying 20 results from an estimated 3000 matches similar to: "character arguments with call_R (PR#552)"
2009 Jun 06
1
Qs on calling R from C
Consider the following simple C program:
/*** hello_r.c ***/
#include <Rinternals.h>
SEXP hello() {
return mkString("Hello, world!\n");
}
int main(void) {
SEXP x = hello();
return x == NULL; /* i.e. 0 on success */
}
This program segfaults:
% myR/bin/R CMD LINK gcc -I./R-2.9.0/src/include -L./myR/lib64/R/lib -lR
hello_r.c -o hello_r > /dev/null
% hello_r
zsh:
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
Hi:
My llvm code is:
for( BasicBlock::iterator i = b->begin() , ie = b->end();
b != be ; b ++ ){
if( CallInst * pCall = dyn_cast<CallInst>(i)){
pCall->dump(); //
Function * pFunction = pCall->getCalledFunction();
if( !pFunction ){
}
std::string fname = pFunction->getName();
}
}
The dump result
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
thanks!
After I check the ll file, I find this:
%1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048
%2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg !2048
%3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg !2048
%4 = load i32 (...)*** %3, align 4, !dbg !2048
%5 = getelementptr inbounds i32 (...)** %4, i32 10, !dbg !2048
%6 = load i32 (...)**
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 2:07 PM, songlh at cs.wisc.edu wrote:
> Hi:
>
> My llvm code is:
>
> for( BasicBlock::iterator i = b->begin() , ie = b->end();
> b != be ; b ++ ){
> if( CallInst * pCall = dyn_cast<CallInst>(i)){
>
> pCall->dump(); //
> Function * pFunction = pCall->getCalledFunction();
> if(
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
>> thanks!
>>
>> After I check the ll file, I find this:
>>
>> %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048
>> %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg
>> !2048
>> %3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg
>> !2048
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
> thanks!
>
> After I check the ll file, I find this:
>
> %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048
> %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg !2048
> %3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg !2048
> %4 = load i32 (...)*** %3, align 4, !dbg !2048
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 3:00 PM, songlh at cs.wisc.edu wrote:
>> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
>>> thanks!
>>>
>>> After I check the ll file, I find this:
>>>
>>> %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048
>>> %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg
>>> !2048
>>> %3
2011 Jan 19
0
[LLVMdev] How to get the name and argument of a function
Thanks a lot!
I finally fix my problem.
My code is like this:
//CallInst* pCall pCall is a printf called in my situation
if( ConstantExpr * pCE = dyn_cast<ConstantExpr>( pCall->getArgOperand(0))){
if( GlobalVariable * pGV = dyn_cast<GlobalVariable>( pCE->getOperand(0))){
if( ConstantArray * pCA = dyn_cast<ConstantArray>(
1999 Jul 29
0
call_R
I would like to use the call_R mechanism. Unfortunately I don't fully
understand what the arguments are from the example in
"R-0.64.2/demos/dynload".
Could anybody explain me how I have to define the arguments, e.g., I
want to call R with 5 doubles (or double[5]) and func does not return a
value (is that possible or is it necessary to return at least a dummy?).
This is from the
2000 Aug 31
2
Problem with R INSTALL locfit on DEC alphaev56-dec-osf4.0d
Dear all,
usually I work under linux, but I tried to install R-1.1.1 on
our alpha's which worked well.
However, installation of the locfit package produced the following
warning:
---------%<----------------
Installing package `locfit' ...
libs
/vol/bin/gcc -I/vol/math/R/include -I/usr/local/include -mieee -g
-O2 -c S_e
nter.c -o S_enter.o
S_enter.c: In function `basis':
2015 Mar 30
3
[LLVMdev] Invalid or unaligned stack
Hi,
I am encountering a problem that I do not know how to debug. I would
greatly appreciate any guidance on this issue.
On Windows when I run Lua test cases from JITed code I am getting
following error:
Unhandled exception at 0x00007FFCEEEAC500 (ntdll.dll) in lua.exe:
0xC0000028: An invalid or unaligned stack was encountered during an
unwind operation.
This is happening when the Lua code is
2011 Dec 28
1
external pointers
I have an external pointer object that I'd like to pass from my R code to
some C code. Per Section 5.13 of "Writing R Extensions", I've noted that
"external pointers should only be used as part of an object with normal
semantics, for example an attribute or an element of a list." So I've
written up a workable C function as such:
SEXP my_c_function(SEXP param)
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded
C functions on a Sparc 10 with R compiled
using cc (both R-0.49 and R-0.50). I get sporadic errors with the
error message:
Error: character variables must be duplicated in .C/.Fortran,
with C functions which pass character variables.
my C functions look like: anyfunc(char **filename, other variables )
This error message appears about 25%
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded
C functions on a Sparc 10 with R compiled
using cc (both R-0.49 and R-0.50). I get sporadic errors with the
error message:
Error: character variables must be duplicated in .C/.Fortran,
with C functions which pass character variables.
my C functions look like: anyfunc(char **filename, other variables )
This error message appears about 25%
2003 Jul 16
1
Integrating R in OpenOffice
Hi All,
A group of about 3-4 of us are looking into the possibility of incorporating R
into OpenOffice's (OO) spreadsheet component (sc) . We wish to use OO's nice
ODBC ability to query a postgresql-based gene expression database thus
populating an OO sc and then use Bioconductor via R to analyse user-selected
parts of this spreadsheet.
We've looked at and compiled and used
2011 Jun 26
2
Why is looping in R inefficient, but in C not?
Hey,
I just read another post about calling R from C. Someone on
stackoverflow (DWin makes me suspect its David W.?) referenced this:
http://www.math.univ-montp2.fr/~pudlo/R_files/call_R.pdf
Which made me think: Why is a loop in R bad, but in C not?
And where exactly does looping cost the most? I wrote a piece of code
for my bachelor's thesis where I loop from 1 to 500, and estimate a
2011 Jan 17
5
[LLVMdev] How to get the name and argument of a function
Hi everyone:
The code I am analyzing is :
int main()
{
int i = 0;
printf("hello world!");
printf( "%d" , i );
}
I want to get each place where printf is called, and the argument used
during that call.
so I write llvm pass code like:
void Myfunction( Function & F){
for( Function::iterator b = F.begin() , be = F.end() ;
2009 Oct 01
2
creating environments in package's C code
Dear developers,
is it possible to create environments in C code of packages?
Simply using
SEXP env;
PROTECT (env = allocSExp(ENVSXP));
and assigning the enclosing environment with SET_ENCLOS seems to be
insufficient.
Best wishes,
Martin
--
Dr. Martin Becker
Statistics and Econometrics
Saarland University
Campus C3 1, Room 206
66123 Saarbruecken
Germany
2009 Mar 03
1
profiler and loops
Hello,
(This is follow up from this thread:
http://www.nabble.com/execution-time-of-.packages-td22304833.html but
with a different focus)
I am often confused by the result of the profiler, when a loop is
involved. Consider these two scripts:
script1:
Rprof( )
x <- numeric( )
for( i in 1:10000){
x <- c( x, rnorm(10) )
}
Rprof( NULL )
print( summaryRprof( ) )
script2:
2020 Feb 26
1
Profiling: attributing costs to place of invocation (instead of place of evaluation)?
Hi
Consider the following example:
f <- function(expr) g(expr)
g <- function(expr) {
? h(expr)
}
h <- function(expr) {
? expr # evaluation happens here
? i(expr)
}
i <- function(expr) {
? expr # already evaluated, no costs here
? invisible()
}
rprof <- tempfile()
Rprof(rprof)
f(replicate(1e2, sample.int(1e4)))
Rprof(NULL)
cat(readLines(rprof), sep = "\n")
#>