abi

在 flutter 上使用 c 代码 - (二) 无源码的项目

自作多情 提交于 2020-01-27 03:05:22
写在前面, 对于无源码的项目, 理论上必须有头文件,不然你不知道里面都定义了什么鬼东西. 本篇虽然是写无源码的项目, 但实际上还是会有源码部分, 只是通过 cmake,clang,xcodebuild,ndk 等工具编译成 so/framework 以供 android/ios 引入 生成动态库 整体的目录结构是这样的, 如果你只是要引入库, 可以跳过这步, 这步的主要做源码生成库的步骤 $ tree -L 3 cpp-source tree -L 3 cpp-source cpp-source ├── android │ ├── CMakeLists.txt │ ├── build_android.sh │ └── cmd │ └── android.sh ├── ios │ ├── CMakeLists.txt │ ├── build_ios.sh │ ├── cmd │ │ └── ios_abi_build.sh │ └── ios.toolchain.cmake └── src ├── some.cpp └── some.h src 为源码 some.cpp # include "some.h" # include <stdint.h> extern "C" __attribute__ ( ( visibility ( "default" ) ) ) _

智能合约编写实例

眉间皱痕 提交于 2020-01-23 05:58:18
前言 本文主要介绍智能合约的工作原理及其部署过程。 合约部署流程 一般来说,部署智能合约的步骤为 1 : 启动一个以太坊节点 (例如geth或者testrpc)。 使用solc编译智能合约。 => 获得二进制代码。 将编译好的合约部署到网络。(这一步会消耗以太币,还需要使用你的节点的默认地址或者指定地址来给合约签名。) => 获得合约的区块链地址和ABI(合约接口的JSON表示,包括变量,事件和可以调用的方法)。(译注:作者在这里把ABI与合约接口弄混 了。ABI是合约接口的二进制表示。) 用web3.js提供的JavaScript API来调用合约。(根据调用的类型有可能会消耗以太币。) 下 图表示了部署流程: 你的DApp可以给用户提供一个界面先部署所需合约再使用之(如图1到4步),也可以假设合约已经部署了(常见方法),直接从使用合约(如图第6步)的界面开始。 智能合约实例 接下来我们将使用geth的控制台开发一个简单的智能合约并编译部署在私链上,最后与之交互。完成这些后,我们就能对智能合约的运行机制理解得更加深刻。本例子结合了汪晓明关于以太坊的开发的 演示视频 和以太坊项目有关 交易和合约的wiki 。 打开测试网络的控制台 输入以下命令: geth --datadir "~/ethdev" --dev console 2>> geth.log 1 显示如下: zcc

How to avoid STT_GNU_IFUNC symbols in your binary?

和自甴很熟 提交于 2020-01-15 08:53:09
问题 I need to deploy to a Red Hat 4.1.2 box (which has gcc 4.1.2). I use GCC 4.6.1 on Ubuntu 11.10 for development. Unfortunately some of the binaries that my build process creates are not usable on the RedHat machine. The reason seems to be an ABI change, which according to another Stackoverflow question resulted from the introduction of STT_GNU_IFUNC symbols. Is there a way to prevent exporting any such symbols so that my binary can use the old ABI? I used nm to look for any symbols of "i" type

What happens to empty classes in the AMD64 ABI?

与世无争的帅哥 提交于 2020-01-15 01:24:30
问题 I'm looking at the AMD64 ABI and it does not appear to specify how to pass empty class types. For empty class member functions, it seems that this is passed as usual, but for empty classes, Clang generates code that appears to simply ignore this class. Is this correct according to the AMD64 ABI? 回答1: Whilst it is unclear exactly what the question is, the answer is pretty clear as to what the C++ ABI is: For the C++ ABI we will use the IA-64 C++ ABI and instantiate it appropriately. The

Binary compatibility between VS2017 and VS2015

守給你的承諾、 提交于 2020-01-11 10:13:43
问题 This SO post: Is Visual-C++-2017 binary compatible with VC++-2015? clearly says that VS 2017 is binary compatible with VS 2015. It even looks like the official position. My question is, in the past, I distinctly remember running into linker errors (I do not recall the specific set of errors) every time I try to link in a static library that was compiled with a different version of MSVC into an EXE that is being built with a newer version of MSVC. Yet, binary (in)compatibility sounds like

Why would the ELF header of a shared library specify Linux as the OSABI?

微笑、不失礼 提交于 2020-01-11 08:19:11
问题 All the standard shared libraries on my Linux system (Fedora 9) specify ELFOSABI_NONE (0) as their OSABI. This is fine - however I've received a shared library from a supplier where the OSABI given in the ELF header is ELFOSABI_LINUX (3). This doesn't sound like an unreasonable value for a shared library intended for a Linux system, however it is a different value to that of all my other libraries - and so when I try to open this library, with dlopen(), from one of my other libraries this

What are callee and caller saved registers?

荒凉一梦 提交于 2020-01-09 03:01:10
问题 I'm having some trouble understanding the difference between caller and callee saved registers and when to use what. I am using the MSP430 : procedure: mov.w #0,R7 mov.w #0,R6 add.w R6,R7 inc.w R6 cmp.w R12,R6 jl l$loop mov.w R7,R12 ret the above code is a callee and was used in a textbook example so it follows the convention. R6 and R7 are callee saved and R12 is caller saved. My understanding is that the callee saved regs aren't "global" in the sense that changing its value in a procedure

Problems linking CUDA-compiled with Boost-using code

亡梦爱人 提交于 2020-01-07 03:09:43
问题 Questions about CUDA-cum-Boost interaction occasionally pop up her on SO, but they are always (?) about compilation : CUDA has trouble with Boost's voodoo tricks. The common wisdom is to isolate your code using Boost from your CUDA-compiled code. So, I've done this: I'm writing a small CUDA utility, with boost::program_options nicely limited to use in the implementation of a single class. My problems are in linking . I'm working on Debian Stretch (64-bit), which is built with GCC 5.x (and

A few questions about legal arguments to printf(“%s”, …)

流过昼夜 提交于 2020-01-03 09:19:11
问题 I'm creating a modified printf implementation, and I'm not sure about the answers to these questions. Does zero work as a null string? (Is printf("%s", 0) allowed?) I'm guessing no, because 0 is an int . But then this prompts this question: Does NULL work as a null string? (Is printf("%s", NULL) allowed?) Logically, I think it should be yes, because NULL implies a pointer; but a lot of implementations seem to have #define NULL 0 , so I feel in practice it might be no. Which is correct? Does

What ABI, if any, restricts the size of [u]intmax_t?

烈酒焚心 提交于 2020-01-03 07:22:32
问题 Starting with the 1999 edition, the ISO C standard defines a standard header <stdint.h> which defines, among other things, the typedefs intmax_t and uintmax_t . These designate, respectively, "a (signed|unsigned) integer type capable of representing any value of any (signed|unsigned) integer type". For example, if, as is typical, the widest signed and unsigned integer types are long long int and unsigned long long int , both of which are typically 64 bits, then intmax_t and uintmax_t might be