librclone

command
v1.56.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 6 Imported by: 0

README

librclone

This directory contains code to build rclone as a C library and the shims for accessing rclone from C and other languages.

Note for the moment, the interfaces defined here are experimental and may change in the future. Eventually they will stabilse and this notice will be removed.

C

The shims are a thin wrapper over the rclone RPC.

Build a shared library like this:

go build --buildmode=c-shared -o librclone.so github.com/artpar/rclone/librclone

Build a static library like this:

go build --buildmode=c-archive -o librclone.a github.com/artpar/rclone/librclone

Both the above commands will also generate librclone.h which should be #included in C programs wishing to use the library.

The library will depend on libdl and libpthread.

Documentation

For documentation see the Go documentation for:

C Example

There is an example program ctest.c with Makefile in the ctest subdirectory.

gomobile

The gomobile subdirectory contains the equivalent of the C binding but suitable for using with gomobile using something like this.

gomobile bind -v -target=android -javapkg=org.rclone github.com/artpar/rclone/librclone/gomobile

The command generates an Android library (aar) that can be imported into an Android application project. Librclone will be contained within libgojni.so and loaded automatically.

// imports
import org.rclone.gomobile.Gomobile;
import org.rclone.gomobile.RcloneRPCResult;

// initialize rclone
Gomobile.rcloneInitialize();

// call RC method and log response.
RcloneRPCResult response = Gomobile.rcloneRPC("core/version", "{}");
Log.i("rclone", "response status: " + response.getStatus());
Log.i("rclone", "output: " + response.getOutput());

// Clean up when finished.
Gomobile.rcloneFinalize();

This is a low level interface - serialization, job management etc must be built on top of it.

iOS has not been tested (but should probably work).

Further docs:

python

The python subdirectory contains a simple Python wrapper for the C API using rclone linked as a shared library with ctypes.

You are welcome to use this directly.

This needs expanding and submitting to pypi...

TODO

  • Async jobs must currently be cancelled manually at the moment - RcloneFinalize doesn't do it.
  • This will use the rclone config system and rclone logging system.
  • Need examples showing how to configure things,

Documentation

Overview

Package librclone exports shims for C library use

This directory contains code to build rclone as a C library and the shims for accessing rclone from C.

The shims are a thin wrapper over the rclone RPC.

Build a shared library like this:

go build --buildmode=c-shared -o librclone.so github.com/artpar/rclone/librclone

Build a static library like this:

go build --buildmode=c-archive -o librclone.a github.com/artpar/rclone/librclone

Both the above commands will also generate `librclone.h` which should be `#include`d in `C` programs wishing to use the library.

The library will depend on `libdl` and `libpthread`.

Directories

Path Synopsis
Package gomobile exports shims for gomobile use
Package gomobile exports shims for gomobile use
Package librclone exports shims for library use This is the internal implementation which is used for C and Gomobile libaries which need slightly different export styles.
Package librclone exports shims for library use This is the internal implementation which is used for C and Gomobile libaries which need slightly different export styles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL