So for my project, I am doing my coding on Python and mainly C++, then I have a GUI interface form made on VB, so how do I link all these things together for a final product?

PS: Someone told me about DLL's I don't know what that is, could someone please briefly in laymen terms explain that to me?

Thanks so much in advance for helping an ultra-n00b!

Recommended Answers

All 2 Replies

A DLL is a Dynamic Link Library. It is essentially a collection of compiled functions that can be called from another executable (or another DLL). So, instead of compiling your C++ code into a executable, you compile it into a DLL with a set of functions that you want to call from your other non-C++ executable. There are some restrictions when dealing with another programming language. Essentially, all programming languages can pretty much deal with a DLL whose functions are C functions. So, you need to make all your functions that you "export" from the DLL into C functions. That means, you are confined to the rules and types of C for that function's prototype (return type and parameter types). This doesn't mean that your entire DLL needs to be in C, just the prototype of your exported functions. Moreover, you need to harmonize the "calling convention", which means your exported DLL functions should be of a standard calling convention, the safest bet is "stdcall". So, depending on your OS and compiler, the usual declaration of a DLL exported function is:

extern "C" int __attribute(__dllexport) __stdcall add(int a, int b) {
  return a + b;
};

The extern "C" tells the compiler to make this function look like a C function to the outside world (even though it is compiled in C++). The __attribute(__dllexport) tells the compiler that this function should be exported from the DLL (visible to another application to call it). And the __stdcall tells the compiler that the calling convention for this function should be "stdcall" (which is the standard calling convention used in windows, but also is frequently used everywhere and all languages will support it).

I am not familiar too much with VB (haven't done any VB since early high-school, many years ago) nor with Python. But you can certainly call C-compatible stdcall functions from any language, but you will have to do some googling to figure out exactly how.

Sounds like your using the wrong language all together. Consider using java, where it has all that for you, or just use pure C++ with a GUI library support. The easiest route would be to use java, but that depends on if you know java and how well you know it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.