我最近意识到strdup()我喜欢在OS X上使用的功能不是ANSI C的一部分,而是POSIX的一部分.我不想重写我的所有代码,所以我想我只是要编写自己的strdup()函数.这并不难,真的,它只是一个malloc()和一个strcpy().无论如何,我有这个功能,但是如果我编写这个函数并将其链接到我的代码,我该怎么做,它已经存在于libc中了?我的链接器或编译器是否允许我基本上定义我自己的函数版本,还是我必须给它另一个名字?如果有一种方法可以重用相同的名称,那将是非常方便的,因此如果strcpy()存在于用户的libc中,他们可以使用它,但如果它们的libc中不存在,则可以使用我的版本,而只需使用少量代码尽可能地改变.
简短版本:
a)当我编写与内置函数同名的自己的函数时会发生什么?
b)我可以做些什么来避免在strdup()没有重写我的所有代码而不使用的平台上发生的不良事情strdup(),这有点单调乏味?
我正在尝试构建和安装Apache Thrift编译器和库
如说明所示运行 ./configure && make
我收到这个错误:
thrift 0.9.3
Building C++ Library ......... : no
Building C (GLib) Library .... : no
Building Java Library ........ : no
Building C# Library .......... : no
Building Python Library ...... : no
Building Ruby Library ........ : no
Building Haxe Library ........ : no
Building Haskell Library ..... : no
Building Perl Library ........ : no
Building PHP Library ......... : no
Building Erlang Library ...... : no
Building Go Library .......... …Run Code Online (Sandbox Code Playgroud)