Switched to using ImportC

This commit is contained in:
Tristan B. Velloza Kildaire 2022-11-28 18:27:38 +02:00
parent 8ad431a76b
commit 2fbfef56f8
2 changed files with 12 additions and 7 deletions

View File

@ -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"
}

View File

@ -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();