I want to write a library that has a defined function
(special_subroutine in
this example) aliased different names (special_subroutine_1 and
special_subroutine_2 in this example). i.e., I need to call a function
with
different names. Can someone give some help?
I try the following way, but it did not work. Can someone give me a
suggestion?
#gcc -c mylibrary.c
#gcc -c test.c
#gcc -o test test.o mylibrary.o
-------------------------------------------------------
//file name: test.c
//date: 07/09/2006
#include "mylibrary.h"
int main(int argc, char** argv){
...
special_subroutine_1( );
....
special_subroutine_2( );
}
------------------------------------------------------
//file name: mylibrary.c
//date: 07/09/2006
void special_subroutine(void){
....//some computation
}
#ifdef weak_alias
weak_alias(special_subroutine_1, special_subroutine)
weak_alias(special_subroutine_1, special_subroutine)
#endif
--------------------------------------------------
I think MPI library does something like this. e.g it has something like
weak_alias MPI_SEND with PMPI_SEND. Maybe pthread library also does
something similiar.