From 2fbfef56f8a41b93f3af378b1435fdc1d4de7269 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Mon, 28 Nov 2022 18:27:38 +0200 Subject: [PATCH] Switched to using ImportC --- dub.json | 4 +--- source/libtun/adapter.d | 15 +++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dub.json b/dub.json index b69d297..b5d9502 100644 --- a/dub.json +++ b/dub.json @@ -6,7 +6,5 @@ "description": "TUN adapter for D", "license": "LGPL-3.0", "name": "libtun", - "targetType": "library", - "preBuildCommands": ["cc $PACKAGE_DIR/source/libtun/tunctl.c -o $PACKAGE_DIR/source/tunctl.o -c"], - "lflags": ["$PACKAGE_DIR/source/tunctl.o"] + "targetType": "library" } \ No newline at end of file diff --git a/source/libtun/adapter.d b/source/libtun/adapter.d index 85574a0..9ea6ed0 100644 --- a/source/libtun/adapter.d +++ b/source/libtun/adapter.d @@ -8,11 +8,13 @@ import core.stdc.stdio; /** * TUN maintenance routines in `tunctl.c` +* TODO: Use import C here */ -extern (C) int createTun(char* interfaceName, int iffFlags); -extern (C) int destroyTun(int fd); -extern (C) int tunWrite(int fd, char* data, int length); -extern (C) int tunRead(int fd, char* data, int amount); +import libtun.tunctl; +// extern (C) int createTun(char* interfaceName, int iffFlags); +// extern (C) int destroyTun(int fd); +// extern (C) int tunWrite(int fd, char* data, int length); +// extern (C) int tunRead(int fd, char* data, int amount); public class TUNAdapter { @@ -50,6 +52,11 @@ public class TUNAdapter } } + public void setAddress() + { + + } + public void close() { sanityCheck();