Using a different error() function

I have some code that I need to use in a PG C program that uses a different error() than the standard library error.

For some reason, even though I don’t import error.h and there is an #undef error in the file that declares the new error() function, PGCC is not using this new error, and instead calling the error() in libc, creating a segfault.

What do I need to do to use the correct error function? This is on pgcc 15.10-0 64-bit target on x86-64 Linux -tp sandybridge.

Hi Aaron,

I tried to write a simple example, but it works fine. Can you post a reproducing example?

% cat testerr.c
#include <stdio.h>
#include <error.h>

void error(int status, int errno, const char *str, ...){
  printf("my error %s %d %d\n",str, errno,status);

}

int main() {
   error(1,1,"calling error");
}
% pgcc testerr.c -V15.10 ; a.out
my error calling error 1 1

Thanks,
Mat