[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: concerns when integrating C++ code into guile?
From: |
Hans Aberg |
Subject: |
Re: concerns when integrating C++ code into guile? |
Date: |
Wed, 7 Jan 2015 15:45:36 +0100 |
> On 7 Jan 2015, at 14:52, Matt Wette <address@hidden> wrote:
>
> Python is written in C yet Qt has been integrated in to produce PyQt. I
> wonder how that is done. I will take a look.
If Python can be compiled as C++, that might be one way.
For proper C, the example below compiles with:
gcc -lstdc++ main.c test_extern_C.cc -o main
‘gcc' is though 'clang' on OS X 10.10.
----
// test_extern_C.cc
#include <string>
#include <cstring>
char str[30];
extern "C" char* hi() {
std::string s("Hello world!\n");
strcpy(str, s.c_str());
return str;
}
----
/* main.c */
#include <stdio.h>
extern char* hi();
int main() {
char* p = hi();
printf(p);
return 0;
}
----
Re: concerns when integrating C++ code into guile?, Chris Vine, 2015/01/07
Re: concerns when integrating C++ code into guile?, Hans Aberg, 2015/01/07
Re: concerns when integrating C++ code into guile?, Ludovic Courtès, 2015/01/07