summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2019-11-02 23:51:23 +0800
committerruki <[email protected]>2019-11-02 23:51:23 +0800
commitb0a7b7a70cafc7988a33e1856147622b0ea92559 (patch)
treebeecf055fd33bc2824f985b9f12af87fcd7f088d /core/src
parent4f932ba407833f9559a23037958c7388cc22d2e0 (diff)
fix ffi for linux
Diffstat (limited to 'core/src')
-rw-r--r--core/src/demo/xmake.lua1
-rw-r--r--core/src/xmake/ffi.c53
-rw-r--r--core/src/xmake/ffi.h46
-rw-r--r--core/src/xmake/machine.c4
-rw-r--r--core/src/xmake/makefile1
5 files changed, 1 insertions, 104 deletions
diff --git a/core/src/demo/xmake.lua b/core/src/demo/xmake.lua
index 2e26afb6e..b1b178dde 100644
--- a/core/src/demo/xmake.lua
+++ b/core/src/demo/xmake.lua
@@ -27,6 +27,7 @@ target("demo")
-- add links
if is_plat("windows") then
add_links("ws2_32", "advapi32", "shell32")
+ add_ldflags("/export:malloc", "/export:free")
elseif is_plat("android") then
add_links("m", "c")
elseif is_plat("macosx") then
diff --git a/core/src/xmake/ffi.c b/core/src/xmake/ffi.c
deleted file mode 100644
index a863e9489..000000000
--- a/core/src/xmake/ffi.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*!A cross-platform build utility based on Lua
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Copyright (C) 2015 - 2019, TBOOX Open Source Group.
- *
- * @author ruki
- * @file ffi.c
- *
- */
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "xmake.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_enter__
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * wrap and export interfaces for ffi
- */
-__tb_export__ void* xm_ffi_malloc(unsigned long size)
-{
- return (void*)tb_malloc((tb_size_t)size);
-}
-__tb_export__ void xm_ffi_free(void* data)
-{
- tb_free(data);
-}
-tb_void_t xm_ffi_bind()
-{
- // avoid to be optimized
- tb_used(&xm_ffi_malloc);
- tb_used(&xm_ffi_free);
-}
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_leave__
diff --git a/core/src/xmake/ffi.h b/core/src/xmake/ffi.h
deleted file mode 100644
index a9885e53b..000000000
--- a/core/src/xmake/ffi.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*!A cross-platform build utility based on Lua
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Copyright (C) 2015 - 2019, TBOOX Open Source Group.
- *
- * @author ruki
- * @file ffi.h
- *
- */
-#ifndef XM_FFI_H
-#define XM_FFI_H
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "prefix.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_enter__
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * interfaces
- */
-
-/// bind ffi
-tb_void_t xm_ffi_bind(tb_noarg_t);
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_leave__
-
-#endif
diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c
index c022ce6ab..4319023cc 100644
--- a/core/src/xmake/machine.c
+++ b/core/src/xmake/machine.c
@@ -29,7 +29,6 @@
* includes
*/
#include "xmake.h"
-#include "ffi.h"
#if defined(TB_CONFIG_OS_WINDOWS)
# include <windows.h>
# include <io.h>
@@ -693,9 +692,6 @@ xm_machine_ref_t xm_machine_init()
}
#endif
- // bind ffi interfaces
- xm_ffi_bind();
-
// ok
ok = tb_true;
diff --git a/core/src/xmake/makefile b/core/src/xmake/makefile
index 269db0c0b..b3028e984 100644
--- a/core/src/xmake/makefile
+++ b/core/src/xmake/makefile
@@ -12,7 +12,6 @@ xmake_CONFIG = y
# core files
xmake_C_FILES += \
- ffi \
xmake \
machine \
os/argv \