swig

How can I build RDKits C# Wrappers — Visual Studio 2019 x64

被刻印的时光 ゝ 提交于 2020-04-16 02:47:21
问题 I have followed the steps described here: https://github.com/bp-kelley/rdkit-csharp to try and create RDKits C# Wrappers. git clone https://github.com/bp-kelley/rdkit-csharp.git git clone https://github.com/rdkit/rdkit.git cd rdkit-csharp build.bat While trying running the build.bat I've run into an error to do with creating named generators (among many others) and I'm not sure how to sort it out. The build.bat references Visual Studio 14 and Visual Studio 14 Win64 I have tried to update this

【译】GNU Radio How to write a block 【如何开发用户模块及编写功能块】

不问归期 提交于 2020-04-10 17:16:55
本文讲解如何在GNU Radio中添加用户开发的信号处理模块,译文如有不当之处可参考原文地址: http://gnuradio.microembedded.com/outoftreemodules Out-of-tree modules   利用用户自定义的功能模块扩展GNU Radio。   This article borrows heavily from the original (but very outdated) "How to write a block?" written by Eric Blossom. 1. What is an out-of-tree module?   外部模块(Out-of-tree Module)是不存在与GNU Radio源代码树的GNU Radio组件。通常,用户自己扩展GNU Radio的功能模块,被称作外部模块。一般我们不会向实际的GNU Radio源代码树中添加东西,除非你是想把他上传给发开者们整合使用。添加外部模块既允许你维护你自己的代码,并且延续主代码的功能。   很多这样的外部模块由 CGRAN 主持,这个一个关于GNU Radio的智囊团。如果你开发了非常nice的东西,请将他提交到CGRAN!    spectral estimation toolbox 是外部模块的一个例子,它的谱估计功能扩展了GNU Radio

如何阅读TensorFlow源码

心不动则不痛 提交于 2020-04-05 19:13:11
通过bazel学习之后,大概了解了TensorFlow的项目的源文件和描述文件。 下面是一篇不错的介绍,搬砖 here 。 在静下心来默默看了大半年机器学习的资料并做了些实践后,打算学习下现在热门的TensorFlow的实现,毕竟系统这块和自己关系较大。本文会简单的说明一下如何阅读TensorFlow的源码。最重要的是了解其构建工具bazel以及脚本语言调用c或cpp的包裹工具swig。这里假设大家对bazel及swig以及有所了解(不了解的可以google下)。要看代码首先要知道代码怎么构建,因此本文的一大部分会关注构建这块。 如果从源码构建TensorFlow会需要执行如下命令: bazel build -c opt //tensorflow/tools/pip_package:build_pip_package 对应的BUILD文件的rule为: sh_binary( name = "build_pip_package", srcs = ["build_pip_package.sh"], data = [ "MANIFEST.in", "README", "setup.py", "//tensorflow/core:framework_headers", ":other_headers", ":simple_console", "//tensorflow:tensorflow

How to make a std::map to hold different data types in swig?

老子叫甜甜 提交于 2020-03-25 18:19:18
问题 How can I make deque<map<char, int>> fp(vector<int> inp_list) to deque<map<char, any>> fp where in any I want this map to store int, string and list of array. I know there are some solutions exist like in c++ 17 I can use Any as given in this link but how to interface it with swig? I can't find any reference where someone has used map for different data types in swig. f_p.i: %module f_p #define SWIGPYTHON_BUILTIN %{ #include "numpy/arrayobject.h" #define SWIG_FILE_WITH_INIT /* To import_array

c++与python混合编程

无人久伴 提交于 2020-03-24 06:26:37
本文分4个部分 C/C++ 调用 Python (基础篇)— 仅讨论Python官方提供的实现方式 Python 调用 C/C++ (基础篇)— 仅讨论Python官方提供的实现方式 C/C++ 调用 Python (高级篇)— 使用 Cython Python 调用 C/C++ (高级篇)— 使用 SWIG 1 C/C++ 调用 Python(基础篇) Python 本身就是一个C库。你所看到的可执行体python只不过是个stub。真正的python实体在动态链接库里实现,在Windows平台上,这个文件位于 %SystemRoot%\System32\python27.dll。 调用示例: //my_python.c #include <Python.h> int main(int argc, char *argv[]) { Py_SetProgramName(argv[0]); Py_Initialize(); PyRun_SimpleString("print 'Hello Python!'\n");//此接口可执行字符串形式的代码 Py_Finalize(); return 0; } 在Windows平台下,利用vs命令提示符,编译命令为 cl my_python.c -IC:Python27\include C:\Python27\libs\python27.lib

C/C++ 与 Python 的通信

爱⌒轻易说出口 提交于 2020-03-21 07:17:41
作者:Jerry Jho 链接:https://www.zhihu.com/question/23003213/answer/56121859 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 C/C++ 调用 Python (基础篇)— 仅讨论Python官方提供的实现方式 Python 调用 C/C++ (基础篇)— 仅讨论Python官方提供的实现方式 C/C++ 调用 Python (高级篇)— 使用 Cython Python 调用 C/C++ (高级篇)— 使用 SWIG 1 C/C++ 调用 Python(基础篇) Python 本身就是一个C库。你所看到的可执行体python只不过是个stub。真正的python实体在动态链接库里实现,在Windows平台上,这个文件位于 %SystemRoot%\System32\python27.dll。 你也可以在自己的程序中调用Python,看起来非常容易: //my_python.c #include <Python.h> int main(int argc, char *argv[]) { Py_SetProgramName(argv[0]); Py_Initialize(); PyRun_SimpleString("print 'Hello Python!'\n"); Py

Swig C++ to C#: How to wrap classes from C++ to make methods from template class available in derived class in C#?

蹲街弑〆低调 提交于 2020-02-23 03:49:40
问题 I have template class BaseMyPoint in namespace external::internal It implements public methods X(), Y(), Z() and SetCoord(). Then write typedef internal::BaseMyPoint MyPointd; Create derived class MyPoint, that inherits MyPointd with public Description of both classes is stored in a file "myPoint.h": #pragma once #ifdef MYPOINTSDLL_EXPORTS #define MYPOINTSDLL_API __declspec(dllexport) #else #define MYPOINTSDLL_API __declspec(dllimport) #endif namespace external { namespace internal { template

Swig 使用指南

允我心安 提交于 2020-02-16 14:29:13
如何使用 API swig.init({ allowErrors: false, autoescape: true, cache: true, encoding: 'utf8', filters: {}, root: '/', tags: {}, extensions: {}, tzOffset: 0 }); options: allowErrors : 默认值为 false。将所有模板解析和编译错误直接输出到模板。如果为 true,则将引发错误,抛出到 Node.js 进程中,可能会使您的应用程序崩溃。 autoescape : 默认true,强烈建议保持。字符转换表请参阅转义过滤器。 true: HTML安全转义 false: 不转义,除非使用转义过滤器或者转义标签 'js': js安全转义 cache : 更改为 false 将重新编译每个请求的模板的文件。正式环境建议保持true。 encoding 模板文件编码 root 需要搜索模板的目录。如果模板传递给 swig.compileFile 绝对路径(以/开头),Swig不会在模板root中搜索。如果传递一个数组,使用第一个匹配成功的数组项。 tzOffset 设置默认时区偏移量。此设置会使转换日期过滤器会自动的修正相应时区偏移量。 filters 自定义过滤器或者重写默认过滤器,参见自定义过滤器指南。 tags

Swig模板使用指南

心已入冬 提交于 2020-02-16 14:27:52
一、如何使用 1、API swig.init({ allowErrors: false, autoescape: true, cache: true, encoding: 'utf8', filters: {}, root: '/', tags: {}, extensions: {}, tzOffset: 0 }); options: allowErrors: 默认值为 false。将所有模板解析和编译错误直接输出到模板。如果为 true,则将引发错误,抛出到 Node.js 进程中,可能会使您的应用程序崩溃。 autoescape: 默认true,强烈建议保持。字符转换表请参阅转义过滤器。 true: HTML安全转义 false: 不转义,除非使用转义过滤器或者转义标签 'js': js安全转义 cache: 更改为 false 将重新编译每个请求的模板的文件。正式环境建议保持true。 encoding: 模板文件编码 root: 需要搜索模板的目录。如果模板传递给 swig.compileFile 绝对路径(以/开头),Swig不会在模板root中搜索。如果传递一个数组,使用第一个匹配成功的数组项。 tzOffset: 设置默认时区偏移量。此设置会使转换日期过滤器会自动的修正相应时区偏移量。 filters:自定义过滤器或者重写默认过滤器,参见自定义过滤器指南。 tags: