12.07.2015 Views

RealView 编译工具编译器参考指南 - ARM Information Center

RealView 编译工具编译器参考指南 - ARM Information Center

RealView 编译工具编译器参考指南 - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

编 译 器 特 有 的 功 能f();}__weak void f(void);void h(){f();}无 法 从 定 义 某 个 函 数 或 变 量 的 同 一 编 译 中 弱 使 用 该 函 数 或 变 量 。以 下 代 码 从 h() 中 非 弱 使 用 f():__weak void f(void);void h(){f();}void f() {}链 接 器 不 会 从 库 中 加 载 函 数 或 变 量 , 除 非 其 他 编 译 非 弱 使 用 该 函数 或 变 量 。 如 果 一 直 没 有 解 析 引 用 , 则 假 定 其 值 为 NULL。 但 是 ,如 果 引 用 是 指 从 代 码 中 对 位 置 无 关 节 或 缺 少 的 __weak 函 数 的 引 用 ,则 未 解 析 的 引 用 不 是 NULL。函 数 定 义无 法 内 联 弱 定 义 的 函 数 。示 例__weak const int c;// assume 'c' is not present in final linkconst int *f1() { return &c; } // '&c' returns non-NULL if// compiled and linked /ropi__weak int i;// assume 'i' is not present in final linkint *f2() { return &i; } // '&i' returns non-NULL if// compiled and linked /rwpi__weak void f(void);// assume 'f' is not present in final linktypedef void (*FP)(void);FP g() { return f; }// 'g' returns non-NULL if// compiled and linked /ropi另 请 参 阅• 《 实 用 程 序 指 南 》 中 的 第 3 章 使 用 armar, 以 了 解 有 关 库 搜 索 的 详 细 信息 。4-22 Copyright © 2007-2009 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348BCNon-Confidential, Unrestricted AccessID090708

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!