In an ruby c extension, How to link it with a shared library

Hi,
I have a simple shared library written in c++ and named libfoo.so, the
header files is:
#ifndef FOO_H
#define FOO_H

#ifdef __cplusplus
extern “C”
{
#endif

void say(const char *pSentence);

#ifdef __cplusplus
}
#endif

#endif

When I use nm libfoo.so | grep say, I can get such result:
00000916 t _GLOBAL__I_say
00000858 T say

But when I use have_library(“foo”, “say”) in extconfig.rb, it fails.
Previously I compile libfoo.so in c, and it can find this library.
I don’t why this happens, could you help me?
Thanks in advance!

Hi,

At Fri, 16 Jun 2006 17:27:34 +0900,
huiliang wu wrote in [ruby-talk:197613]:

But when I use have_library(“foo”, “say”) in extconfig.rb, it fails.
Previously I compile libfoo.so in c, and it can find this library.

A shared library created with C++ compiler would need also C++
runtime library to link. have_library doesn’t support C++
directly yet. If you use g++, try have_library(“stdc++”)
before “foo”.