R package using compiled Pascal code

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 parse 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.

Not an expert, I can't advise much on the structure

Two clarifications needed: do you want to make the package available to others (e.g. on CRAN), and are you going to include the binary or the source code?

From the manual:

A source package if possible should not contain binary executable files: they are not portable, and a security risk if they are of the appropriate architecture. R CMD check will warn about them4 unless they are listed (one filepath per line) in a file BinaryFiles at the top level of the package. Note that CRAN will not accept submissions containing binary files even if they are listed.

For CRAN packages containing C/C++/Fortran, typically the package only contains the source, you don't distribute binaries. That means the user may need to compile the code during installation ( or the CRAN servers may also pre-compile). An example of not-officially-supported language used in some packages is Rust, there are some non-trivial aspects. For Pascal, I didn't really find cases of it being used in R packages, so you'd have to figure out a lot. My guess is that it's probably not feasible without a lot of work (or negotiation).

If, on the other hand, you are not submitting to CRAN, that shouldn't be a problem.

1 Like

Hi! Thanks for your message.

In the long term, the project should ideally be on CRAN, but we plan to convert the code to C++ for this and it's currently not the primary goal.

So yes, I'm coming to broadly the same conclusions as you are here (see this similar discussion), so it seems fine enough for me.

I just wanted to be sure I wasn't missing something or a better way of doing what I do.

Thanks again :grin:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.