Android 3.0의 렌더러에서 일부 도우미 함수를 작성했으며 오버로드 가능으로 선언 된 빌트인 함수를 오버로드하려고 시도 할 때 문제가 발생했습니다. 포인터를 취하는 함수.문제 Android에서 오버로드 함수 Renderscript
파일 : * graphics_helper.rsh *
typedef struct color4_s {
float red;
float blue;
float green;
float alpha;
} color;
extern void __attribute__((overloadable))
rsgClearColor(color c);
파일 : * graphics_helper.rs *이
inline void __attribute__((overloadable)) rsgClearColor(color c) {
rsgClearColor(c.red,c.green,c.blue,c.alpha);
}
위와 같이 컴파일하려고, 나는 오류를 얻을
error: invalid function name prefix, "rs" is reserved: 'rsgClearColor'
함수를 컴파일하려면 이름을 변경해야합니다 (예 : gClearColor
). 게다가, 안드로이드 툴은 구조체에 대한 포인터를 취하는 함수를 프로토 타입 화하려고하면 불평하는 것으로 보입니다. 따라서, 예를 들어 모두 (a) 내장 함수 이름 과부하에 I는 (수 있어야 clang documentation 기준 오차
Failed to export the function _Z11gClearColorP8color4_s. There's at least one parameter whose type is not supported by the reflectionRSContext::processExport : failed to export func 'gClearColor'
을
extern void __attribute__((overloadable))
gClearColor(color* c);
생산 (상기와 동일한 구조체를 사용하여) b) 포인터를 취하는 오버로드 된 함수를 작성하지만 둘 다 작동하지 않는 것 같습니다.