Commit 8739b1c2 authored by Kunshan Wang's avatar Kunshan Wang

Skeleton of C-initiating-style C binding.

parent 7a574230
......@@ -39,4 +39,18 @@ lazy val root = (project in file(".")).settings(
antlr4GenVisitor in Antlr4 := false
)
lazy val jarList = taskKey[Seq[File]]("list dependency jars")
jarList := {
val cp: Seq[File] = (dependencyClasspath in Compile).value.files
cp
}
lazy val makeJarListFile = taskKey[Unit]("write a list of dependency jar paths separated by colons (:) to target/jars.txt")
makeJarListFile := {
val jl = jarList.value
val jlStr = jl.mkString(":")
println("Dependency jars: " + jlStr)
IO.write(new java.io.File("cbinding/jars.txt"), jlStr)
}
CFLAGS += -std=gnu11
ifndef JAVA_HOME
$(error JAVA_HOME is required. Invoke with 'make JAVA_HOME=/path/to/java/home')
endif
.PHONY: all
all: libmurefimpl2start.so
libmurefimpl2start.so: refimpl2-start.c cbinding.txt
$(CC) -fPIC -shared $(CFLAGS) -o $@ $< $(LDFLAGS)
cbinding.txt: ../build.sbt
cd .. ; sbt makeJarListFile
.PHONY: clean
clean:
rm *.so
#include <stdint.h>
#include <stdlib.h>
#include "refimpl2-start.h"
MuVM *mu_refimpl2_new() {
return NULL;
}
MuVM *mu_refimpl2_new_ex(int64_t heap_size, int64_t global_size, int64_t stack_size) {
return NULL;
}
void mu_refimpl2_close(MuVM *mvm) {
}
#ifndef __REFIMPL2_START_H__
#define __REFIMPL2_START_H__
#include <stdint.h>
#include "muapi.h"
#ifdef __cplusplus
extern "C" {
#endif
MuVM *mu_refimpl2_new();
MuVM *mu_refimpl2_new_ex(int64_t heap_size, int64_t global_size, int64_t stack_size);
void mu_refimpl2_close(MuVM *mvm);
#ifdef __cplusplus
}
#endif
#endif // __REFIMPL2_START_H__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment