Casting an address to a function: using "void * void "

Mike

I came across a function call

    // call the entry point from the ELF header
    // note: does not return!
    ((void (*)(void)) (ELFHDR->e_entry & 0xFFFFFF))();

ELFHDR->e_entry is a function pointer. I think ((void (*)(void)) is the return type. But I'm not sure what the type void * void is.

Is there a rule to tell such type?

Thanks!

Michael Burr

You say that "I think ((void (*)(void)) is the return type" - it's not. It's casting the expression

(ELFHDR->e_entry & 0xFFFFFF)

to be a pointer to a function that takes no arguments and returns nothing.

The last () on the statement calls the function through that pointer.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Send mail to an email address using Yesod

来自分类Dev

using jsp in javascript function

来自分类Dev

将地址转换为函数:使用“ void * void”

来自分类Dev

Getting ip address using MySQL query

来自分类Dev

Using timeit on a cython function

来自分类Dev

Get the value of a variable using the hexadecimal memory address

来自分类Dev

Using a Function to plot in R

来自分类Dev

Casting "with" Interface

来自分类Dev

Turn casting / construction into a perfect forwardable function

来自分类Dev

Mapping mac address into elasticsearch index using jdbc river

来自分类Dev

对'__gthrw___pthread_key_create的未定义引用(unsigned int *,void(*)(void *))

来自分类Dev

如何使用std :: function <void(void)>调用方法

来自分类Dev

将元素插入std :: vector <void **(void *)>

来自分类Dev

指针和多线程错误,预期为“ void *(*)(void *)”,但参数的类型为“ pthread_t”

来自分类Dev

(void(*)(void *))的含义

来自分类Dev

Nullpointer异常“ void void android.media.MediaPlayer.setDataSource(android.content.Context,android.net.Uri)”

来自分类Dev

错误:从'int(*)(void *)'到'void *(*)(void *)'的无效转换

来自分类Dev

Using a function as dictionary

来自分类Dev

函数指针不兼容的指针类型从void(my_type *)变为void(*)(void *)

来自分类Dev

Swift中的void->(void)是什么意思?

来自分类Dev

C:将void(*)(void *)转换为void(*)(char *)

来自分类Dev

不兼容的指针类型从'int(int *)'分配给'void(*)(void *)'

来自分类Dev

尝试创建线程时从'void *(*)(int(*)[2])'无效转换为'void *(*)(void *)

来自分类Dev

Get correct IP address using $_SERVER["REMOTE_ADDR"]

来自分类Dev

g ++编译器:从'pthread_t {aka long unsigned int}'到'void *(*)(void *)'的错误无效转换[-fpermissive]

来自分类Dev

无法从pthread中的void *(类名)(void *)类型转换为void *(*)(void *)类型

来自分类Dev

g++ 错误从“void*”到“info*”的无效转换[-fpermissive],错误:从“void*”到“void*(*)(void*)”的无效转换[-fpermissive]

来自分类Dev

无法解析构造函数 'Order(Java.lang.string,Java.lang.string,Java.lang.string,void,void)

来自分类Dev

Python 在传感器的 DLL 中调用 SDK 函数,该函数采用指针 IP 和端口并返回 void*(void* 配置文件传感器的句柄。)

Related 相关文章

  1. 1

    Send mail to an email address using Yesod

  2. 2

    using jsp in javascript function

  3. 3

    将地址转换为函数:使用“ void * void”

  4. 4

    Getting ip address using MySQL query

  5. 5

    Using timeit on a cython function

  6. 6

    Get the value of a variable using the hexadecimal memory address

  7. 7

    Using a Function to plot in R

  8. 8

    Casting "with" Interface

  9. 9

    Turn casting / construction into a perfect forwardable function

  10. 10

    Mapping mac address into elasticsearch index using jdbc river

  11. 11

    对'__gthrw___pthread_key_create的未定义引用(unsigned int *,void(*)(void *))

  12. 12

    如何使用std :: function <void(void)>调用方法

  13. 13

    将元素插入std :: vector <void **(void *)>

  14. 14

    指针和多线程错误,预期为“ void *(*)(void *)”,但参数的类型为“ pthread_t”

  15. 15

    (void(*)(void *))的含义

  16. 16

    Nullpointer异常“ void void android.media.MediaPlayer.setDataSource(android.content.Context,android.net.Uri)”

  17. 17

    错误:从'int(*)(void *)'到'void *(*)(void *)'的无效转换

  18. 18

    Using a function as dictionary

  19. 19

    函数指针不兼容的指针类型从void(my_type *)变为void(*)(void *)

  20. 20

    Swift中的void->(void)是什么意思?

  21. 21

    C:将void(*)(void *)转换为void(*)(char *)

  22. 22

    不兼容的指针类型从'int(int *)'分配给'void(*)(void *)'

  23. 23

    尝试创建线程时从'void *(*)(int(*)[2])'无效转换为'void *(*)(void *)

  24. 24

    Get correct IP address using $_SERVER["REMOTE_ADDR"]

  25. 25

    g ++编译器:从'pthread_t {aka long unsigned int}'到'void *(*)(void *)'的错误无效转换[-fpermissive]

  26. 26

    无法从pthread中的void *(类名)(void *)类型转换为void *(*)(void *)类型

  27. 27

    g++ 错误从“void*”到“info*”的无效转换[-fpermissive],错误:从“void*”到“void*(*)(void*)”的无效转换[-fpermissive]

  28. 28

    无法解析构造函数 'Order(Java.lang.string,Java.lang.string,Java.lang.string,void,void)

  29. 29

    Python 在传感器的 DLL 中调用 SDK 函数,该函数采用指针 IP 和端口并返回 void*(void* 配置文件传感器的句柄。)

热门标签

归档