How to correctly assign a pointer returned by dlsym into a variable of function pointer type?

前端 未结 6 1046
悲&欢浪女
悲&欢浪女 2020-12-31 01:00

I am trying to use dlopen() and dlsym() in my code and compile it with gcc.

Here is the first file.

/* main.c          


        
6条回答
  •  旧巷少年郎
    2020-12-31 01:26

    To keep the -pedantic option for your code while having parts of code that are not strictly conforming, separate that code into a separate file with custom warning options.

    So, make a function that wraps the dlsym function and returns a function pointer. Put it in a separate file and compile that file without -pedantic.

提交回复
热议问题