Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C OpenGL
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 4-May-13 16:03pm
docomo1738
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
v2
Comments
docomo1 at 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 at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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).
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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[^]
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 195
1 ProgramFOX 130
2 Maciej Los 105
3 Afzaal Ahmad Zeeshan 82
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100