title: Undefined symbol - confused
body: <p>On Ubuntu 10.04 LTS:</p>
  
  <pre><code>/usr/bin/g++ -&gt; g++-4.4
  /usr/bin/gcc -&gt; gcc-4.4
  </code></pre>
  
  <p>I am writing a libssl_ext library in Ubuntu which is based on openssl library (libssl.a and libssl.so)
  When I type</p>
  
  <pre><code>$nm -C -defined-only -g libssl_ext.so
  </code></pre>
  
  <p>I can see the following symbols defined</p>
  
  <pre><code>00005140 D SSLv3_enc_data_Ext
  **00002800 T SSLv3_server_method_Ext**
  00005174 A __bss_start
  00005174 A _edata
  0000517c A _end
  00003aa8 T _fini
  00001954 T _init
  00002d70 T ssl3_accept_Ext
  00002480 T ssl3_enc_Ext
  00002850 T ssl3_get_client_key_exchange_Ext
  000026f0 T ssl3_write_Ext
  00002320 T ssl3_write_bytes_Ext
  </code></pre>
  
  <p>When I type:</p>
  
  <pre><code>$nm -C -defined-only -g libssl.so
  </code></pre>
  
  <p>I can see the following symbols defined</p>
  
  <pre><code>....
  00018930 T SSLv3_client_method
  00050600 D SSLv3_enc_data
  00013640 T SSLv3_method
  **00013690 T SSLv3_server_method**
  00026f40 T TLSv1_client_method
  000506c0 D TLSv1_enc_data
  00026ea0 T TLSv1_method
  00026ef0 T TLSv1_server_method
  .....
  </code></pre>
  
  <p>When I call the SSLv3_server_method_Ext in my server.cpp code, it has an issue:</p>
  
  <pre><code>server.cpp:70: undefined reference to SSLv3_server_method_Ext()
  </code></pre>
  
  <p>When I type :</p>
  
  <pre><code>$ nm -C --undefined-only -g server.o 
  </code></pre>
  
  <p>It shows the following:</p>
  
  <pre><code>U CRYPTO_free
  U ERR_print_errors_fp
  U SSL_CIPHER_get_name
  U SSL_CTX_ctrl
  U SSL_CTX_free
  U SSL_CTX_new
  U SSL_CTX_set_cipher_list
  U SSL_accept
  U SSL_free
  U SSL_get_current_cipher
  U SSL_get_error
  U SSL_get_peer_certificate
  U SSL_get_version
  U SSL_library_init
  U SSL_new
  U SSL_read
  U SSL_set_fd
  U SSL_shutdown
  U SSL_write
  **U SSLv3_server_method**
  U X509_NAME_oneline
  U X509_free
  **U SSLv3_server_method_Ext()**
  U __gxx_personality_v0
  U accept
  U bind
  U close
  U exit
  U htons
  U inet_ntoa
  U listen
  U memset
  U perror
  U printf
  U puts
  U socket
  U stderr
  </code></pre>
  
  <p>There is a difference when I link the <strong>SSLv3_server_method from libssl.so
  with server.o</strong>, it shows as  "U SSLv3_server_method" and can be linked successfully with libssl.so.
  But when I link the <strong>SSLv3_server_method_Ext from libssl_ext.so with server.o</strong>, it shows as "U SSLv3_server_method_Ext()"
  and failed with undefined reference to SSLv3_server_method_Ext()</p>
  
  <p>Please if someone explains to me <strong>why the server.o is looking for SSLv3_server_method_Ext() instead of SSLv3_server_method_Ext</strong> and how to fix this problem? The linker was correctly looking for SSLv3_server_method when I call libssl.so and it is found.</p>