Skip to content

Instantly share code, notes, and snippets.

@daxim
Created July 7, 2020 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daxim/17ba671f0c42ac5b5677953e6cfc1382 to your computer and use it in GitHub Desktop.
Save daxim/17ba671f0c42ac5b5677953e6cfc1382 to your computer and use it in GitHub Desktop.
FFI::Platypus
qmake-qt5 && make -j
#include <testapp.h>
#include <QApplication>
#include <wobjectimpl.h>
W_OBJECT_IMPL(Testapp)
Testapp::Testapp(QWidget *parent) : QMainWindow(parent) {
}
Testapp::~Testapp() {
}
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
Testapp w;
w.show();
return a.exec();
}
#ifndef TESTAPP_H_INCLUDED
#define TESTAPP_H_INCLUDED
#include <wobjectdefs.h>
#include <QObject>
#include <QMainWindow>
class Testapp : public QMainWindow {
W_OBJECT(Testapp)
public:
Testapp(QWidget *parent = nullptr);
~Testapp();
};
#endif // TESTAPP_H_INCLUDED
package Testapp;
use FFI::Platypus;
use FFI::Platypus::Memory qw(free malloc);
my $ffi = FFI::Platypus->new;
$ffi->lang('CPP');
$ffi->lib('./testapp.o');
QT += core gui widgets
CONFIG += c++14
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
testapp.cpp
HEADERS += \
testapp.h
INCLUDEPATH += ../verdigris/src # https://github.com/woboq/verdigris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment