me icon indicating copy to clipboard operation
me copied to clipboard

记录和分享技术的博客

Results 107 me issues
Sort by recently updated
recently updated
newest added

Version: Swift 5.6, macOS 12.3, Xcode 11 # Unsafe Swift - WWDC20 Benefits of unsafe interfaces: - Interoperability with code written in C or Objective-C - Control over runtime performance...

favor

[ClangFormat — Clang 15.0.0git documentation](https://clang.llvm.org/docs/ClangFormat.html) - clangformat 是一个代码格式化工具,支持C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# - macos 通过`brew install clangformat`安装 - 可以通过`clang-format -style=llvm -dump-config > .clang-format`形成一个配置文件 - 设置选项: [Clang-Format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) 自己搭配了一下: .clang-format ```yaml # 可选套餐: LLVM,...

## Overview ### Core Video - CVBuffer - CVImageBuffer - CVPixelBuffer (`typealias CVPixelBuffer = CVImageBuffer`) - CVPixelBufferPool - CVPixelFormatDescription - CVTime ### Core Media - CMSampleBuffer (在压缩后,CMSampleBuffer中包含CMBlockBuffer,当表达压缩前则包含CVPixelBuffer) - CMBlockBuffer (在抽象顶层,表示任意buffer,多指压缩后数据)...

## hello world 先起一个linux c的项目, foo.c ```c int biubiubiu() { return 666; } ``` Makefile ```make libfoo.a: foo.o libtool -static -o $@ $^ foo.o: foo.c clang -c -arch arm64 -arch...

## Mac OS X: Built to Evolve > Complex systems come into existence in only two ways: through careful planning or through evolution. An airport is an example of something...

favor

还没想好,先记录 - linux c通过ar将.o生成lib,macOS需要通过`libtool -static -o libxxx xxx.o` - 在Xcode中,将arm64的lib复制到项目目录中,会自动添加到target的library中,也可以直接添加外部library - 然后需要在bridge header中增加c definition,或者直接将lib的header复制到项目中,然后在bridge中引用 - 从swift到c还是会很曲折,比如需要用到pointer,然后不支持可变参数等等兼容性问题,所以需要通过package或者framework做一层转换,提供给swift调用方native的接口,就是在swift和c lib中做一个转换层 ## Mach-O - Mach-O是Mach Object文件格式的缩写,等同于Windows上的PE,Linux上的elf - Object file: .o - Library: .a, .dylib,...

假设我们需要对n个数进行求和,设计函数: `sum(int, ...);`, 虽然C支持可变函数, 但是在sum函数中无法获取可变参数的数量,它只是往栈上去压参数,所以**必须**人为设定数量,就有了如下实现: ```c int sum(int n, ...) { va_list args; int sum = 0; va_start(args, n); for (int i = 0; i < n; ++i) { sum...

没看懂。。。过 ## 参考阅读 - [Modules — Clang 15.0.0git documentation](https://clang.llvm.org/docs/Modules.html) - [从预编译的角度理解Swift与Objective-C及混编机制 - 美团技术团队](https://tech.meituan.com/2021/02/25/swift-objective-c.html) - [LLVM的 Modules · stephenwzl](https://www.stephenw.cc/2017/08/23/llvm-modules/) - [iOS 预编译思考 - @import | Minos's Elysium](https://minosjy.com/2021/03/25/15/294/)