Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6242767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:00:58+00:00 2026-05-24T12:00:58+00:00

R.h and Rmath.h are header files for an interface between R.app and C. But,

  • 0

“R.h” and “Rmath.h” are header files for an interface between R.app and C. But, they seems to be readable only through a R command ‘R CMD SHLIB something.c’

I wish to compile my native C program to include them using gcc. I’m using Snow Leopard where I’m not able to locate those header files!

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:00:59+00:00Added an answer on May 24, 2026 at 12:00 pm

    Please see the ‘Writing R Extensions’ manual about details, you can easily compile and link against Rmath.h and the standalone R Math library — but not R.h. (Which you can use via Rcpp / RInside but that is a different story.)

    There are a number of examples floating around for use of libRmath, one is in the manual itself. Here is one I ship in the Debian package r-mathlib containing this standalone math library:

    /* copyright header omitted here for brevity */
    
    #define MATHLIB_STANDALONE 1
    #include <Rmath.h>
    
    #include <stdio.h>
    typedef enum {
        BUGGY_KINDERMAN_RAMAGE,
        AHRENS_DIETER,
        BOX_MULLER,
        USER_NORM,
        INVERSION,
        KINDERMAN_RAMAGE
    } N01type;
    
    int
    main(int argc, char** argv)
    {
    /* something to force the library to be included */
        qnorm(0.7, 0.0, 1.0, 0, 0);
        printf("*** loaded '%s'\n", argv[0]);
        set_seed(123, 456);
        N01_kind = AHRENS_DIETER;
        printf("one normal %f\n", norm_rand());
        set_seed(123, 456);
        N01_kind = BOX_MULLER;
        printf("normal via BM %f\n", norm_rand());
    
        return 0;
    }
    

    and on Linux you simply build like this (as I place the library and header in standard locations in the package; add -I and -L as needed on OS X)

    /tmp $ cp -vax /usr/share/doc/r-mathlib/examples/test.c mathlibtest.c
    `/usr/share/doc/r-mathlib/examples/test.c' -> `mathlibtest.c'
    /tmp $ gcc -o mathlibtest mathlibtest.c -lRmath -lm
    /tmp $ ./mathlibtest
    *** loaded '/tmp/mathlibtest'
    one normal 1.119638
    normal via BM -1.734578
    /tmp $ 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need R header files to compile something. I installed R on ubuntu via:
I am trying to run a sample Firemonkey app on a Mac, but I
I am developing an android app where I have to rotate a circular image
I just found about the @rpath to load .dylib files using dlopen, and need
Php doesn't load extensions specified through php.ini php -v doesn't give any errors or
I have an executable built from several object files and linked with several static
I need to get a file creation date&time using python. I tried: os.stat(rpath)[ST_CTIME] But
I'm trying to build freetds but want it to include the static libraries in
I've recently built a linux platform interface for Cocotron, and was able to build
i use xcode with libsqlite3.dylib for sqlite , but when i compile to device

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.