from setuptools import setup, Extension
module = Extension(
'bitlib',
libraries=['BitLib'],
include_dirs=[r'E:\BitScope\Library'],
library_dirs=[r'E:\BitScope\Library'],
sources=['bitlibmodule.c']
)
setup(
name="bitlib",
version="2.0",
maintainer="codenio",
maintainer_email="[email protected]",
description="BitScope Library Python3 Extension module",
ext_modules=[module]
)
static PyObject * bitlib_BL_Acquire ( PyObject * self, PyObject * args ) {
PyObject * L = NULL; int N = 0; bool Alternate = 0;
if ( ! PyArg_ParseTuple(args, "|iO", &N, &L) )
return NULL;
if ( N <= 0 )
N = BL_Size(BL_ASK);
if ( N <= 0 ) {
PyErr_SetString(PyExc_TypeError, "Acquisition size is unknown.");
return NULL;
}
if ( L && ! PyList_Check( L ) ) {
PyErr_SetString(PyExc_TypeError, "Second argument should be a list.");
return NULL;
} else { int i;
double *D = malloc(N * sizeof(double));
if (D == NULL) {
PyErr_SetString(PyExc_MemoryError, "Unable to allocate memory.");
return NULL;
}
N = BL_Acquire( N, D );
if ( N > 0 ) {
if ( ! L ) {
L = PyList_New(N);
Alternate = 1;
}
for ( i = 0; i < N; i++ )
PyList_SetItem( L, i, Py_BuildValue("d", D[i]) );
if ( Alternate )
return L;
}
return Py_BuildValue("l", (long) N );
}
}
running install
running bdist_egg
running egg_info
writing bitlib.egg-info\PKG-INFO
writing dependency_links to bitlib.egg-info\dependency_links.txt
writing top-level names to bitlib.egg-info\top_level.txt
reading manifest file 'bitlib.egg-info\SOURCES.txt'
writing manifest file 'bitlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
building 'bitlib' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IE:\BitScope\Library -IE:\Anaconda\Anaconda3\envs\ml\include -IE:\Anaconda\Anaconda3\envs\ml\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /Tcbitlibmodule.c /Fobuild\temp.win-amd64-3.8\Release\bitlibmodule.obj
bitlibmodule.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:E:\BitScope\Library /LIBPATH:E:\Anaconda\Anaconda3\envs\ml\libs /LIBPATH:E:\Anaconda\Anaconda3\envs\ml\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" BitLib.lib /EXPORT:PyInit_bitlib build\temp.win-amd64-3.8\Release\bitlibmodule.obj /OUT:build\lib.win-amd64-3.8\bitlib.cp38-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.8\Release\bitlib.cp38-win_amd64.lib
正在创建库 build\temp.win-amd64-3.8\Release\bitlib.cp38-win_amd64.lib 和对象 build\temp.win-amd64-3.8\Release\bitlib.cp38-win_amd64.exp
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Mode
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Delay
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Select
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Send
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Receive
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_State
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Acquire
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Count
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Offset
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Version
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Close
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Trigger
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Time
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Intro
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Coupling
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Log
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Initialize
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Rate
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Trace
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Range
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Enable
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Halt
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Size
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_ID
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Index
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Name
bitlibmodule.obj : error LNK2001: 无法解析的外部符号 BL_Open
build\lib.win-amd64-3.8\bitlib.cp38-win_amd64.pyd : fatal error LNK1120: 27 个无法解析的外部命令
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120