C# unmanaged function pointers for iOS

Just a reminder to myself when I need this thing next time for making Unity work with native code:

  • delegate method should be static to please AOT compiler required for iOS
  • method should have have [MonoPInvokeCallback(typeof(YourDelegate))] attribute. its code is as simple as this:

    [AttributeUsage (AttributeTargets.Method)]
    public sealed class MonoPInvokeCallbackAttribute : Attribute
    {
    public MonoPInvokeCallbackAttribute (Type t) {}
    }
  • for other platforms, delegate should have [UnmanagedFunctionPointer(YourCallingConvention)] attribute, but for iOS it prevents AOT compilation for some reason, so we need to #if it

From : http://nadako.tumblr.com/post/82111636787/c-unmanaged-function-pointers-for-ios

C# unmanaged function pointers for iOS的更多相关文章

  1. new thoughts over function pointers

    Previous works do not relate to function pointers, but reading some documents reading and learning S ...

  2. Function Pointers in C

    来源:https://cs.nyu.edu/courses/spring12/CSCI-GA.3033-014/Assignment1/function_pointers.html Function ...

  3. C语言基础:函数(Function) 分类: iOS学习 c语言基础 2015-06-10 21:48 14人阅读 评论(0) 收藏

    函数:一段具有某些特定功能的代码段. 使用函数的严格规定: 1.函数声明 2.函数定义 3.函数调用 函数声明:告知系统编译器该系统的函数名,函数参数,参数类型,参数个数,参数顺序等等,以便函数调用时 ...

  4. [转] iOS ABI Function Call Guide

    source: apple ARMv6 Function Calling Conventions When functions (routines) call other functions (sub ...

  5. Xamarin.iOS,AOT,JIT,Limitations

    Since applications on the iPhone using Xamarin.iOS are compiled to static code, it is not possible t ...

  6. Xamarin/Mono IOS Limitations

    http://developer.xamarin.com/guides/ios/advanced_topics/limitations/ Since applications on the iPhon ...

  7. [转]ARM64 Function Calling Conventions

    from apple In general, iOS adheres to the generic ABI specified by ARM for the ARM64 architecture. H ...

  8. [转]Passing Managed Structures With Strings To Unmanaged Code Part 1

    1. Introduction. 1.1 Managed structures that contain strings are a common sight. The trouble is that ...

  9. Using Blocks in iOS 4: The Basics

    iOS 4 introduces one new feature that will fundamentally change the way you program in general: bloc ...

随机推荐

  1. PHP中CURL方法curl_setopt()函数的参数

    PHP CURL curl_setopt 参数 bool curl_setopt (int ch, string option, mixed value)curl_setopt()函数将为一个CURL ...

  2. ( 转 ) Android自绘字体大小paint.settextsize随分辨率大小变化

    1.获取当前设备的屏幕大小 DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefau ...

  3. Swift开发小技巧--private访问修饰符报错的情况

    1.Swift中的访问修饰符(三个,作用:用来修饰属性,方法和类) public : 最大权限 -- 可以在当前framework和其他framework中访问 internal : 默认的权限 -- ...

  4. 【51NOD 1478】括号序列的最长合法子段

    很恶心啊,一道水题改了半天,主要是各种细节没有注意到,包括左括号剩余时有可能会出错的情况,需要从后往前扫 贡献一组测试数据: ((()))())(())(( 答案:8 1 #include<cs ...

  5. 【POJ 3243】Clever Y 拓展BSGS

    调了一周,我真制杖,,, 各种初始化没有设为1,,,我当时到底在想什么??? 拓展BSGS,这是zky学长讲课的课件截屏: 是不是简单易懂.PS:聪哥说“拓展BSGS是偏题,省选不会考,信我没错”,那 ...

  6. python复习

    1.input和raw_input的区别 input假设输入的都是合法的python表达式,如输入字符串时候,要加上引号,而raw_input都会将所有的输入作为原始数据 2.原始字符串前面加上r,e ...

  7. javascript 红宝书笔记之如何使用对象 如何操作数组

    对象定义  ===  引用类型,描述的是一类对象所具有的属性和方法     新对象的创建 方法     new + 构造函数       var person = new Object(); 对象字面 ...

  8. 【CodeForces 567E】President and Roads(最短路)

    Description Berland has n cities, the capital is located in city s, and the historic home town of th ...

  9. JavaScript RegExp 对象(来自w3school)

    RegExp 对象用于规定在文本中检索的内容. 什么是 RegExp? RegExp 是正则表达式的缩写. 当您检索某个文本时,可以使用一种模式来描述要检索的内容.RegExp 就是这种模式. 简单的 ...

  10. 开个帖,开始学习shell编程

    恩,就这么开始了 首先说一下这个小小的插曲...写着写着,它就崩溃了,然后我也崩溃了...崩溃的我到处找一个不会让我崩溃的工具,然后找来找去就找到了scribefire. 1. 关于从Command ...