How do I link glibc's implementation of iconv?

前端 未结 1 1317
名媛妹妹
名媛妹妹 2021-02-10 02:40

The GNU C library provides an implementation of iconv - how do I use it?

Simple program:

#include 

int main( int argc, char **argv ) {
           


        
相关标签:
1条回答
  • 2021-02-10 03:25

    Your program seems fine and compiles fine on my system (Mandriva Linux 2010.1).

    I find the libiconv_* references in your compile log worrisome, though. Are you sure that the iconv.h version that gets included comes from glibc and not from a separate libiconv implementation, such as GNU libiconv? It sounds as if it adds a lib prefix to all iconv functions to avoid symbol collisions with the iconv implementation of the C library that came with the system.

    Having to explicitly link to libiconv points to a separate iconv implementation too - glibc does not need it.

    EDIT:

    For the record, I just verified that using the iconv.h header file from libiconv without explicitly linking against it will produce exactly the result that you are seeing - it renames all iconv functions by adding a lib prefix to their names.

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