Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating C++ dll to use with QM; Creating .NET C# dll
This was somewhere in another place. Just moved to Resources to find easier.

Sometimes on the Internet you find some C++ code that does what you need, and want to use it in QM. Converting it to QM is difficult, much work, and sometimes would make too slow. Another solution is to create dll and use the dll in QM. You need some C++ knowledge, but for simple functions often it is not necessary. Just know how to create dll, export functions and use it in QM.


To compile C++ code you need a program that does it. There are many free C++ compilers and IDEs (integrated development environment).

I tested only few, in the past:

Microsoft Visual C++ 2008 Express. Doesn't have a resource editor, but often it is not needed, especially for a simple dll.

Bloodshed Dev-C++.


Download the program. Install.

Run the program.

Create new Win32 dll project. It should create minimum code for the dll. The code should contain DllMain function.

Try to compile (Build) to see if the compiler works well. Must compile without errors. It will create a dll file somewhere in project's folder.

Below or above WinMain function, add your functions. Don't add main() function.

Before each function you want to export (and use in QM) insert extern "C" __declspec(dllexport). With non-Microsoft compilers it may not work. Then can be used def file.

Compile. Must compile without errors. If not, then you have to learn C++ and correct the code.

In QM, declare the exported functions, for example

dll "$desktop$\knaps\release\knaps.dll" knapsack_hs n int*w c int*p int*z int*x

Ready to use.
How to export and use C# functions in QM?

Forum Jump:

Users browsing this thread: 1 Guest(s)