2020-04-28 16:56:33 +08:00
|
|
|
|
# 静态链接与动态链接
|
|
|
|
|
|
2021-07-12 09:57:33 +08:00
|
|
|
|
目前 PC 版本的 awtk 同时生成动态库和静态库,你可以根据具体情况进行选择。
|
|
|
|
|
|
|
|
|
|
> 由于 windows 下多次链接同一个静态库会存在问题,Windows 平台只能使用动态库,动态库是唯一推荐的方式。
|
|
|
|
|
|
|
|
|
|
使用方法如下:
|
2020-04-28 16:56:33 +08:00
|
|
|
|
|
|
|
|
|
## 1. 链接动态库
|
|
|
|
|
|
|
|
|
|
> LIBS 参数使用 awtk.SHARED_LIBS
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
DefaultEnvironment(TOOLS = APP_TOOLS,
|
|
|
|
|
CCFLAGS = awtk.CCFLAGS,
|
|
|
|
|
LIBS = awtk.SHARED_LIBS,
|
|
|
|
|
LIBPATH = awtk.LIBPATH,
|
|
|
|
|
CPPPATH = awtk.CPPPATH,
|
|
|
|
|
LINKFLAGS = awtk.LINKFLAGS,
|
|
|
|
|
TARGET_ARCH=awtk.TARGET_ARCH,
|
|
|
|
|
OS_SUBSYSTEM_CONSOLE=awtk.OS_SUBSYSTEM_CONSOLE,
|
|
|
|
|
OS_SUBSYSTEM_WINDOWS=awtk.OS_SUBSYSTEM_WINDOWS
|
|
|
|
|
)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 2. 链接静态库
|
|
|
|
|
|
|
|
|
|
> LIBS 参数使用 awtk.STATIC_LIBS
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
DefaultEnvironment(TOOLS = APP_TOOLS,
|
|
|
|
|
CCFLAGS = awtk.CCFLAGS,
|
|
|
|
|
LIBS = awtk.STATIC_LIBS,
|
|
|
|
|
LIBPATH = awtk.LIBPATH,
|
|
|
|
|
CPPPATH = awtk.CPPPATH,
|
|
|
|
|
LINKFLAGS = awtk.LINKFLAGS,
|
|
|
|
|
TARGET_ARCH=awtk.TARGET_ARCH,
|
|
|
|
|
OS_SUBSYSTEM_CONSOLE=awtk.OS_SUBSYSTEM_CONSOLE,
|
|
|
|
|
OS_SUBSYSTEM_WINDOWS=awtk.OS_SUBSYSTEM_WINDOWS
|
|
|
|
|
)
|
|
|
|
|
```
|
|
|
|
|
|
2020-08-16 09:10:01 +08:00
|
|
|
|
> 原来的 awtk.LIBS 仍然可以使用,为链接静态库方式。
|