2
如何包装Elf32_Ehdr
和Elf64_Ehdr
以便在64位体系结构Elf64_Ehdr
和Elf32_Ehdr
上使用32位?使用<elf.h>需要帮助
如何包装Elf32_Ehdr
和Elf64_Ehdr
以便在64位体系结构Elf64_Ehdr
和Elf32_Ehdr
上使用32位?使用<elf.h>需要帮助
#include <stdint.h>
#include <elf.h>
#if UINTPTR_MAX == 0xffffffff
#define Elf_Ehdr Elf32_Ehdr
#define Elf_Phdr Elf32_Phdr
#else
#define Elf_Ehdr Elf64_Ehdr
#define Elf_Phdr Elf64_Phdr
#endif
为什么这是错的? 'void * p; .. initilize p omited ..p =(Elf32_Ehdr *)p;',当我尝试引用'p-> e_ident'时,得到了一个警告:'warning:dereferencing'void *'pointer'。为什么演员不工作? –
声明'p =(Elf32_Ehdr *)p;'完全没有任何操作。它将'p'的值转换为'Elf32_Ehdr *'类型的表达式,然后将结果赋给'p',后者隐式转换回'void *'类型。 –
为了将'void *'作为'Elf32_Ehdr *'使用,我错了? –