How do I specify what function to export from .so library, when compiling the C code?

前端 未结 1 452
被撕碎了的回忆
被撕碎了的回忆 2021-02-10 14:15

I have a number of function in my \"C\" code. When I compile .so, I see all names in result .so file. How can I specify (in code or in make file) that only some functions should

1条回答
  •  悲哀的现实
    2021-02-10 15:12

    In C, if you want a function to remain internal to the file (technically, the "compilation unit") that contains it, you declare it "static". For example,

    static int privateAddOne(int x) { return x + 1; }
    

    0 讨论(0)
提交回复
热议问题