Skip to content

Commit

Permalink
Adding README
Browse files Browse the repository at this point in the history
  • Loading branch information
awgh committed Mar 4, 2021
1 parent 12d48ce commit bc725f0
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# universal loader
Universal Shared Library User-space Loader
# The Universal Loader

This loader provides a unified interface for loading shared libraries from Golang on Windows, OSX, and Linux.

Also included is a cross-platform `Call()` implementation that lets you call into exported symbols from those libraries without stress.

### Basic Usage

*libraryPath* set to `lib.so` for Linux, `lib.dyld` for OSX, or `lib.DLL` for Windows, then:

```
image, err = ioutil.ReadFile(libraryPath)
...
loader, err := universal.NewLoader()
...
library, err := loader.LoadLibrary("main", &image)
...
val, err := library.Call("Runme", 7)
...
```

Complete working examples of usage can be found in the examples/ folder in this repo.


### Features and Limitations
- OSX backend uses the system loader, so multiple interdependent libraries can be loaded.
- Linux and Windows backends do not use the system loader, so interdependent libraries cannot be loaded.
- Linux backend does not use memfd!
*I believe this is the first Golang Linux loader that does not use memfd!*

### Supported Architectures
- OSX arm64 M1 Apple Chip (tested)
*This is the first loader I've seen, Golang or not, that works on the M1!*
- OSX amd64 (tested)
- Windows amd64 (tested)
- Windows 386 (untested, should work)
- Linux amd64 (tested)
- Linux 386 (untested, should work)
- Other POSIX systems on 386, amd64, or arm64 (untested, should work)

**If you try this on any untested platforms, whether it works or not, let me know!**

0 comments on commit bc725f0

Please sign in to comment.