Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
2.14/5 (3 votes)
See more:
Hi,

Here is a model that has an arm of aluminum bar and a propeller at the end of bar. The propeller is controlled by a motor so that the arm can moves up and down.The model has another feature that to connect with the pc via serial port.

I have created an Interface of that model in visual c/c++ and openGL. It has the features like measuring the angle(theta), propeller thrust and some corresponding graph as angle vs thrust etc. corresponding the actual system.

So far,all the features are working well.

Now my question is for the controller part. As the controller has two parts-- one part is for PC and the other is for the micro controller board.

Now I want to make the controller for pc part as dynamic. Lets say, I run the whole program. It gives the desired result.
But I want to make a small gui where I can write a small piece of code(in C) for controller(for pc part) and then I only compile that small part of the program not the whole system.

Is it possible?

Any Idea..!!!
The model--

http://www.flickr.com/photos/95493415@N04/8709126378/in/photostream[^]
Thanks.
Posted

Certainly, you need to compile everything, not a part of the code, to run the application.

Even though generating different source code, compiling (you would need to carry a compiler and a linker with your runtime) it and executing is possible and is used in some (quite advanced and unusual) applications, this is a really bad idea, and it does not make the system more "dynamic" as it can be. This idea is based on deep misunderstanding of the very basic programming paradigms. When you build and deploy the code, you don't deploy the development tools with it. Unfortunately, this forum named "Quick Questions & Answers" is not a right place for teaching paradigms and basics of programming. I think it would be enough to say that you need to get serious education in programming.

—SA
 
Share this answer
 
v2
Comments
docomo1 5-May-13 4:38am    
Respected SA,

I accept your comment as a learner and really I want to learn about programming. Can you please tell me what you mean about the 'deploy the development tools' . Do you mean to develop a tool for that part. As my work is going and I thought it would be a new feature that can I add, that's why I asked about suggestion and any idea about that. If you have some useful material or link to suggest, it would be helpful for me.
Sergey Alexandrovich Kryukov 5-May-13 14:26pm    
To compile and link code, you need to have the software: a compiler and a linker, a number of executable files. Now, you develop some software product. The whole business works like this: you compile and link all you source code into executable code. Executable code is some executable files or shared library files (DLLs, it really does not matter much). You send the product without source code to the user or put it on some server, "deploy" it. (Often, you provide source code, but it is not a part of the deployed product. The user can built the product again, acting as a developer.) The compiler, linker and other development tools are never required to run the product.
—SA
Microsoft has provided a mechanism you can use for this called "COM". Using this (obsolete) technology, you define a set of interfaces, write an original COM object that implements all of the interfaces, and the client code that uses this object. You can later update your object or write a new one, which your existing code can use without recompilation.

More blah blah blah on COM can be found here[^].

Some programming examples can be found here[^].

... or ask Google.
 
Share this answer
 
Usually if you want to support something like that you will add some scripting (macro) language support to your application...

Or your application can support some plugins architechture. But you won't use that direction for a typical application that is intented for general users (and not developpers).

I think that a macro language that your parse from your code might be appropriate in your case if you want to give orders to the controller like move left 50 degrees, move up 10 degrees...

But if the target audiance is general user, then it migth be better to have a front-end UI where the user can pick items from a list and execute them either in connected mode (the hardware device move) or in preview mode (you only update the representation on screen).
 
Share this answer
 
1) The Windows operating system supports the mechanism known as Dynamic Link Libraries which allows a library to be kept separate (in a distinct file) from the main application.

Binding with the functions in the library is done at run-time, the main application being able to scan the DLL file and find the entry points (functions if you like) that it contains.

Binding can even be done in a dynamic way, i.e. by invoking the LoadLibrary system function when you want. The FreeLibrary allows you to later release the DLL.

Using this mechanism, you could very well encapsulate part of your code in a DLL that your main application will load and unload when needed, allowing you to edit the DLL code and rebuild it in the meantime.

To achieve this, you need to fully understand the topics of creating and using DLLs. http://msdn.microsoft.com/en-us/library/ms682589(v=VS.85).aspx[^]

2) Another, much easier solution is offered to you: the Microsoft Visual Studio IDE features an amazing debugging mode known as Edit and Continue: it allows you to modifiy the code while running in a debug session and continue with the modified code compiled on the fly. It is not bulletproof but might be what you are looking for.

See http://msdn.microsoft.com/en-us/library/bcew296c(v=VS.80).aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900