how to weak_alias of symbols in application code

Discussion in 'C Programming' started by seyong_choi@hotmail.com, Jul 12, 2006.

  1. Guest

    I want to use alias to call a defined function (special_subroutine in
    this example) using different names (special_subroutine_1 and
    special_subroutine_2 in this example), is it doable? --I tried the
    following way, and it did not work when I tried to compile it with
    gcc. I guess weak_alias is only valid for glibc, or maybe the way I use
    it was wrong.

    Can someone give me a suggestion?

    -------------------------------------------------------
    //file name: test.c
    //date: 07/09/2006
    #ifdef weak_alias
    weak_alias(special_subroutine_1, special_subroutine)
    weak_alias(special_subroutine_1, special_subroutine)
    #endif

    void special_subroutine(void){
    ....//some computation

    }

    int main(int argc, char** argv){
    ...
    special_subroutine_1( );
    ....
    special_subroutine_2( );

    }

    ------------------------------------------------------

    By the way, I knew the following macro (#define special_subroutine_1,
    special_subroutine) can make the example code work. But I really want
    to keep "special_subroutine_1" in the symbol table---which means I
    don't want to use this way.
    #define special_subroutine_1, special_subroutine

    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.
     
    , Jul 12, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QUs=?=

    Debug symbols not for all .aspx forms.

    =?Utf-8?B?QUs=?=, Jan 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    910
    Habib Heydarian [MSFT]
    Jan 23, 2004
  2. Gibs

    Displaying Special Symbols

    Gibs, Jun 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    472
    Ken Cox [Microsoft MVP]
    Jun 29, 2004
  3. Scott Brady Drummonds

    Unresolved Symbols from C++ Code

    Scott Brady Drummonds, Oct 8, 2003, in forum: C++
    Replies:
    3
    Views:
    509
    Jonathan Mcdougall
    Oct 9, 2003
  4. Replies:
    0
    Views:
    519
  5. Replies:
    1
    Views:
    2,175
    Keith Thompson
    Jul 12, 2006
Loading...

Share This Page