Reading data (embedded plist) linked to executable through -sectcreate __TEXT

后端 未结 4 1761
礼貌的吻别
礼貌的吻别 2021-01-31 09:55

I am linking a executable with a plist using -sectcreate __TEXT linker flags. Reason for this is mainly to use the SMJobBless() method. But I need to read plist lin

4条回答
  •  难免孤独
    2021-01-31 10:36

    A much simpler approach:

    #include 
    
    unsigned long *len;
    char *data = getsectdata("__TEXT", "__info_plist");
    

    man getsectdata. There's lots of examples on how to access various pieces (current executable, arbitrary executable, framework, etc).

提交回复
热议问题