Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R package using compiled Pascal code #192

Closed
JosephBARBIERDARNAL opened this issue Aug 16, 2024 · 2 comments
Closed

R package using compiled Pascal code #192

JosephBARBIERDARNAL opened this issue Aug 16, 2024 · 2 comments

Comments

@JosephBARBIERDARNAL
Copy link

Note: I'm not sure if I'm on the right repo for this question, so feel free to tell me I'm not.

Hi, I'm building an R package that uses Pascal executable files. I'm wondering if there are any problems associated with this as I haven't found any real resources on this type of project, as most R packages use C++. Are there any rules to be followed on how to architect the project, call my executables, etc? At the time of writing, I'm just calling executables from src/, depending on the user's operating system.

I have 2 compiled files (one for Windows and one for Unix) that work fine (the output of the program is to write a file, which I then analyse with R).

I have the impression that what I'm doing is very ‘manual’ and perhaps not very intelligent. I'm not looking for exact explanations but rather advice on the direction to take and the resources to look for.

Thanks.

Note 2: I also asked the same question on the POSIT forum, which is perhaps a more appropriate place to ask it.

@gaborcsardi
Copy link
Member

Yes, this is not exactly the right repository. I guess the right place might be the R-package-help or the R-help mailing list.

Nevertheless I could not find any packages with code on CRAN or Bioconductor:
https://github.com/search?q=org%3Acran+language%3APascal+&type=code
https://github.com/search?q=org%3Abioc+language%3APascal+&type=code

According to https://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories-1 you should put executables into bin:

On the other hand, executable programs could be installed along the lines of

execs <- c("one", "two", "three")
if(WINDOWS) execs <- paste0(execs, ".exe")
if ( any(file.exists(execs)) ) {
  dest <- file.path(R_PACKAGE_DIR,  paste0('bin', R_ARCH))
  dir.create(dest, recursive = TRUE, showWarnings = FALSE)
  file.copy(execs, dest, overwrite = TRUE)
}

OTOH I suspect that Pascal code is not supported on CRAN, so you are probably not going to put your package on CRAN, which gives you a lot of flexibility here.

@JosephBARBIERDARNAL
Copy link
Author

OK, that's very helpful.

There are no plans for this project to be on CRAN yet, so that's fine with me.

Thank you for your quick response. I think we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants