If I were to write a glue for a C++ lib, what special considerations must be taken into account? Are there any such modules in Pike right now?
All #include's of pike header files must be within extern "C" { };. C++ doesn't differ between the tag name space and the ordinary name space. This makes code like
struct lex { char *pos; char *end; INT32 current_line; INT32 pragmas; struct pike_string *current_file; int (*current_lexer)(YYSTYPE *); };
extern struct lex lex;
not work, unless C++ has been fixed since I looked at it last.
AFAIK, there are no such modules right now.
/ Henrik Grubbström (Lysator)
Previous text:
2004-07-15 11:33: Subject: Glue for C++ libs
If I were to write a glue for a C++ lib, what special considerations must be taken into account? Are there any such modules in Pike right now?
/ Marcus Agehall (nu med semester)
Thank you. So there shouldn't be any big problems writing a glue then, as long as I do extern "C" in the correct places and try to ensure that no exceptions are left unhandled...
/ Marcus Agehall (nu med semester)
Previous text:
2004-07-15 12:01: Subject: Glue for C++ libs
All #include's of pike header files must be within extern "C" { };. C++ doesn't differ between the tag name space and the ordinary name space. This makes code like
struct lex { char *pos; char *end; INT32 current_line; INT32 pragmas; struct pike_string *current_file; int (*current_lexer)(YYSTYPE *); };
extern struct lex lex;
not work, unless C++ has been fixed since I looked at it last.
AFAIK, there are no such modules right now.
/ Henrik Grubbström (Lysator)
The easiest way to interface with a C++ library, might be to make a glue library which has a plain C interface, and then use that from a C module.
/ Henrik Grubbström (Lysator)
Previous text:
2004-07-15 12:29: Subject: Glue for C++ libs
Thank you. So there shouldn't be any big problems writing a glue then, as long as I do extern "C" in the correct places and try to ensure that no exceptions are left unhandled...
/ Marcus Agehall (nu med semester)
I have written a wrapper for a C++ library. The easiest way was to just write it and stop worrying about it. No interface library is needed.
/ Per Hedbor ()
Previous text:
2004-07-15 13:03: Subject: Glue for C++ libs
The easiest way to interface with a C++ library, might be to make a glue library which has a plain C interface, and then use that from a C module.
/ Henrik Grubbström (Lysator)
pike-devel@lists.lysator.liu.se