ATBTariffCalculator/Calculator/main.cpp
2024-03-21 16:57:53 +01:00

61 lines
1.7 KiB
C++

#include <QCoreApplication>
#include <QString>
#include <QDebug>
#include <QLibrary>
#include <stdio.h>
#include <stdlib.h>
#include "message_handler.h"
#include "calculator_c_interface_lib.h"
//#include "tariff_calculator.h"
typedef TariffCalculator *TariffCalculatorHandle;
typedef TariffCalculatorHandle (*NewTariffCalculatorFunc)();
typedef void (*DeleteTariffCalculatorFunc)(TariffCalculatorHandle handle);
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if (!messageHandlerInstalled()) {
atbInstallMessageHandler(atbDebugOutput);
//setDebugLevel(LOG_NOTICE);
}
#if 1
//TariffCalculatorHandle handle = NewTariffCalculator();
//DeleteTariffCalculator(handle);
//if (InitGitLibrary() > 0) {
// qCritical() << CloneRepository("https://git.mimbach49.de/GerhardHoffmann/customer_999.git", "C:\\tmp\\customer_999");
// qCritical() << CheckoutLocalBranch("C:\\tmp\\customer_999", "master");
// ShutdownGitLibrary();
// }
qCritical() << GetFileMenuSize("customer_999");
#else
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);
}
}
#endif
return 0; // a.exec();
}