[gambit-list] Difficulties linking against a C++ library

Ramil Farkhshatov ramil at gmx.co.uk
Tue Feb 24 08:58:56 EST 2009


On Tue, Feb 24, 2009 at 05:41:24AM -0800, John Thompson wrote:
> Hi,
> 
> I'm trying to get a toy, loadable C++ library compiled.  My setup is as follows:
> 
> foo.scm:
> 
>  (define bar (c-lambda (char-string) int "cpp_bar"))
> 
> foo.cpp:
> 
> int cpp_bar(char* text) {
>   return 0;
> }
> 
> foo.h:
> 
> int cpp_bar(char* text);

Prototype in foo.h should be defined like:

extern "C" int cpp_bar(char *text);

or

extern "C" {
int cpp_bar(char* text);
…
}

for a group of functions.

-- 
Ramil Farkhshatov




More information about the Gambit-list mailing list