ATBTariffCalculator/Calculator/main.cpp

56 lines
1.4 KiB
C++
Raw Normal View History

2024-03-11 12:14:28 +01:00
#include <QCoreApplication>
#include <QString>
2024-03-04 16:31:14 +01:00
#include <QDebug>
2024-03-11 12:14:28 +01:00
#include <QLibrary>
#include <stdio.h>
#include <stdlib.h>
#include "message_handler.h"
2024-03-04 16:31:14 +01:00
#include "calculator_c_interface_lib.h"
2024-03-11 12:14:28 +01:00
//#include "tariff_calculator.h"
typedef TariffCalculator *TariffCalculatorHandle;
typedef TariffCalculatorHandle (*NewTariffCalculatorFunc)();
typedef void (*DeleteTariffCalculatorFunc)(TariffCalculatorHandle handle);
//extern "C" {
//#include "calculator_c_interface_lib.h"
//bool __declspec(dllimport) initTariffEditor();
//}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if (!messageHandlerInstalled()) {
atbInstallMessageHandler(atbDebugOutput);
//setDebugLevel(LOG_NOTICE);
}
QLibrary library("C:\\build-ATBTariffCalculator-Desktop_Qt_6_5_0_MinGW_64_bit-Release\\CalculatorCInterface\\release\\CalculatorCInterface.dll");
if (library.load()) {
qCritical() << "loaded";
NewTariffCalculatorFunc f = (NewTariffCalculatorFunc) library.resolve("NewTariffCalculator");
TariffCalculatorHandle handle = 0;
if (f) {
qCritical() << "resolved";
handle = f();
}
DeleteTariffCalculatorFunc d = (DeleteTariffCalculatorFunc) library.resolve("DeleteTariffCalculator");
if (d) {
qCritical() << "resolved";
d(handle);
}
}
//initTariffEditor();
2024-03-04 16:31:14 +01:00
2024-03-11 12:14:28 +01:00
return 0; // a.exec();
2024-03-04 16:31:14 +01:00
}