strlen_alias.c revision 5c655f82b95ba6f043ec7235d3e711131fd9a2bc
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/* $Id$ */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/** @file
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * IPRT - No-CRT strlen() alias for gcc.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/*
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2006-2008 Sun Microsystems, Inc.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * available from http://www.virtualbox.org. This file is free software;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * you can redistribute it and/or modify it under the terms of the GNU
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * General Public License (GPL) as published by the Free Software
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * The contents of this file may alternatively be used under the terms
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * of the Common Development and Distribution License Version 1.0
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * VirtualBox OSE distribution, in which case the provisions of the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * CDDL are applicable instead of those of the GPL.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * You may elect to license modified versions of this file under the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * terms and conditions of either the GPL or the CDDL or both.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * additional information or have any questions.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync/*******************************************************************************
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync* Header Files *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync*******************************************************************************/
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync#include <iprt/nocrt/string.h>
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync#undef strlen
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync# ifndef __MINGW32__
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync# pragma weak strlen
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync# endif
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/* No alias support here (yet in the ming case). */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncextern char *(strlen)(const char *psz)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync{
619824b60d668e6e43f385ef78cf06e13d43aab6vboxsync return RT_NOCRT(strlen)(psz);
0f77dc54d7ec617480988ccdfcd080f480e79698vboxsync}
619824b60d668e6e43f385ef78cf06e13d43aab6vboxsync
619824b60d668e6e43f385ef78cf06e13d43aab6vboxsync#elif __GNUC__ >= 4
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/* create a weak alias. */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync__asm__(".weak strlen\t\n"
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync " .set strlen," RT_NOCRT_STR(strlen) "\t\n");
2c95722bb302f4ce9454d04324b09314c0ccc038vboxsync#else
2c95722bb302f4ce9454d04324b09314c0ccc038vboxsync/* create a weak alias. */
619824b60d668e6e43f385ef78cf06e13d43aab6vboxsyncextern __typeof(RT_NOCRT(strlen)) strlen __attribute__((weak, alias(RT_NOCRT_STR(strlen))));
619824b60d668e6e43f385ef78cf06e13d43aab6vboxsync#endif
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync