genbindings: add common binding.h

This commit is contained in:
mappu 2024-09-12 18:47:31 +12:00
parent d2c5d27f37
commit 4882ed676a
2 changed files with 18 additions and 6 deletions

View File

@ -536,6 +536,8 @@ func emitBindingHeader(src *CppParsedHeader, filename string) (string, error) {
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "binding.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -638,12 +640,6 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
ret.WriteString(`#include "` + filename + "\"\n\n")
ret.WriteString(`#include "gen_` + filename + "\"\n")
ret.WriteString(`
extern "C" {
extern void miqt_exec_callback(void* cb, int argc, void* argv);
}
`)
for _, c := range src.Classes {

16
qt/binding.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef GEN_QABSTRACTANIMATION_H
#define GEN_QABSTRACTANIMATION_H
#ifdef __cplusplus
extern "C" {
#endif
// miqt_exec_callback calls a Go function pointer for a connect() slot.
// The function is defined in Go.
void miqt_exec_callback(void* cb, int argc, void* argv);
#ifdef __cplusplus
extern "C" {
#endif
#endif