Hi
I have taken the following code from a webpage and tried to test the call.
Global header file:
#ifndef QTENGINEDLL_GLOBAL_H
#define QTENGINEDLL_GLOBAL_H
#include <QtCore/QtGlobal>
#if defined(QTENGINEDLL_LIBRARY)
# define QTENGINEDLLSHARED_EXPORT Q_DECL_EXPORT
#else
# define QTENGINEDLLSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // QTENGINEDLL_GLOBAL_H
#ifndef QTENGINEDLL_GLOBAL_H
#define QTENGINEDLL_GLOBAL_H
#include <QtCore/QtGlobal>
#if defined(QTENGINEDLL_LIBRARY)
# define QTENGINEDLLSHARED_EXPORT Q_DECL_EXPORT
#else
# define QTENGINEDLLSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // QTENGINEDLL_GLOBAL_H
To copy to clipboard, switch view to plain text mode
QtEngineDll.h
#ifndef QTENGINEDLL_H
#define QTENGINEDLL_H
#include "qtenginedll_global.h"
class QTENGINEDLLSHARED_EXPORT QtEngineDll {
public:
QtEngineDll();
int randInt();
};
#endif // QTENGINEDLL_H
#ifndef QTENGINEDLL_H
#define QTENGINEDLL_H
#include "qtenginedll_global.h"
class QTENGINEDLLSHARED_EXPORT QtEngineDll {
public:
QtEngineDll();
int randInt();
};
#endif // QTENGINEDLL_H
To copy to clipboard, switch view to plain text mode
QtEngineDll.cpp
#include <QTime>
#include "qtenginedll.h"
QtEngineDll::QtEngineDll()
{
//Create random number seed
qsrand((uint)time.msec());
}
int QtEngineDll::randInt()
{
// Random number between low and high
//return qrand() % ((aHigh + 1) - aLow) + aLow;
return 0;
}
#include <QTime>
#include "qtenginedll.h"
QtEngineDll::QtEngineDll()
{
//Create random number seed
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
}
int QtEngineDll::randInt()
{
// Random number between low and high
//return qrand() % ((aHigh + 1) - aLow) + aLow;
return 0;
}
To copy to clipboard, switch view to plain text mode
Now while calling from Vb .net I am using the following command:
<DllImport("G:\Varen_CS\02_Projects\01_Softwares\highFreqTrad\QtDLLImport\test\test\debug\test.dll", _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function QtEngineDll() As Integer
End Function
<DllImport("G:\Varen_CS\02_Projects\01_Softwares\highFreqTrad\QtDLLImport\test\test\debug\test.dll", _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function QtEngineDll() As Integer
End Function
To copy to clipboard, switch view to plain text mode
It is giving me the error: Unable to find an entry point named 'QtEngineDll' in DLL
Can you pls tell me what the wrong I am do'g and what is the entry point to be used from the code?
Also how should I define a different entry point in a dll?
Is it possible to define multiple entry points in a single dll?
Thanks in advance.
Bookmarks