vvofdcx
vvofdcx

Reputation: 519

Qt: how to import dll without header and lib files

I would like to include a dll from this website http://projnet.codeplex.com/ But it only provides a dll file and a xml file, no header file or lib file is included. Is it possible to import the dll using something like

QLibrary geolib("ProjNet.dll");
geolib.load();

If it works (in this case geolib.isloaded is true) then how do I use it in Qt?

Thanks very much!!!

Upvotes: 0

Views: 2215

Answers (2)

ustas
ustas

Reputation: 16

You can use in such a way only exported functions (for this you need to know the function's name and prototype). After you load dll you should invoke resolve method. For example, you want to use exported function foo from MyModule.dll:

extern "C" Q_DECL_EXPORT void foo(int a)

You need to create a prototype:

typedef void (*MyProto)(int)

And than resolve it:

QLibrary myDll("MyModule.dll");
if (myDll.load())
{
    MyProto mp = reinterpret_cast<MyProro>(myDll.resolve("foo"));
}

Unfortunately, ProjNet.dll has no exports.

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 612964

That is a managed DLL, for the .net framework, which explains why it has no header file. You won't be able to use it directly. You'll need to wrap it. For instance with COM or as a mixed mode C++/CLI DLL.

Upvotes: 2

Related Questions