|
Someone asked you a question. Answer it first, or tell us that you didn't understand the question.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
ya actually i didn't understood it.....
i thought that it was an answer....
|
|
|
|
|
When you ship your project, you must make sure that the runtime components required by your application are installed on the target computer. All such components are packed as a redistributable by Microsoft and given to us.
The redist for VC 2008 (x86) is available here:
Visual C++ 2008 Redistributables[^]
The other user asked you if you have installed this redistributable on the target computer, where you get a side-by-side configuration error.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
The Dependency Walker will help you. It is a mighty tool in the DDK to find which dlls are needed.
The cryptic "missing redistributable libs ? " is the right answer. You got to install the VC-runtime in the right Version/Servicepack.
Greetings from Germany
|
|
|
|
|
I am progressing with my C++ learning. I am stuck with the following code.
void ChangeData(int** ptr){
int ab = 1000;
*ptr = &ab;
}
int _tmain(int argc, _TCHAR* argv[])
{
int a = 10;
int* aPtr = &a;
ChangeData(&aPtr);
cout << *aPtr << endl;
return 0;
} In the ChangeData method, I am assigning address of a local variable to the supplied parameter. When ChangeData returns to the main, I believe variable ab will get removed from the stack. I was expecing an error when I run the above application, but the above one works!
I am confused how this is happening? If ab is removed from stack, which address the pointer holds and how I am getting correct value?
|
|
|
|
|
The variable is destroyed, but not the contents.
You know the abbress s you can continue to check it's value...but, as you sad, it is wrong, so do not do it. The system can use the same locatio of that variable in any moment after that the variable is destroyed, so the contentents will be soon invalid.
Russell
|
|
|
|
|
Christian Flutcher wrote: I am confused how this is happening?
Because you were lucky (or in your case, not ). In your ChangeData function, your local variable has a certain address which you store in your ptr variable. When the function exits, your ptr variable still holds the same address but as you said, the variable has been 'removed' from the stack. But remove simply means that this memory can be used for other purposes, which in your case you don't so the memory is not overwritten (and still containing the same value). If now you would do other things before printing the value, chances are that it will not work anymore.
|
|
|
|
|
Cedric Moonen wrote: Because you were lucky
Yes, I am.
Cedric Moonen wrote: If now you would do other things before printing the value, chances are that it will not work anymore.
That makes sense.
Thank you all for the help.
|
|
|
|
|
Christian Flutcher wrote: If ab is removed from stack, which address the pointer holds and how I am getting correct value?
Actually, it is not "removed". That particular memory location is being marked as "available for use". But until you use it, the older value exists.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Thanks Rajesh.
Rajesh R Subramanian wrote: But until you use it, the older value exists
I understand. But how do I use it? I just want to test this.
I have created a big array in the main() and assigned some values to each element thinking that it will use the stack space, but still my old value exist. I am sure that I am doing something wrong. Any ideas?
|
|
|
|
|
Christian Flutcher wrote: I understand. But how do I use it? I just want to test this.
You will not be able to write to a location after the control comes out of it's scope of existence, because now do not have write access to that location.
If you are keen to see yourself rewriting the contents of that 'particular' portion of memory, try a placement new:
Is there a way to force new to allocate memory from a specific area?[^]
Christian Flutcher wrote: I have created a big array in the main() and assigned some values to each element thinking that it will use the stack space, but still my old value exist.
Yes, the stack is simply 'big enough' to hold it all. Besides that, it is an unnecessary exercise to wipe off the contents of the memory location 'as and when' it is freed. Erasing the contents of the freed memory every time will degrade the performance severely.
To tackle this, the memory manager marks that portion of memory as 'available for use', and this will be treated as free memory and the old contents will be replaced with new content, when the program writes to that portion of memory.
Hope that helps.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: Hope that helps
Indeed. Thanks for the help.
|
|
|
|
|
Rajesh R Subramanian wrote: To tackle this, the memory manager marks that portion of memory as 'available for use',
I'm not an expert on the stack but I guess there's even no need to mark some memory blocks as available. It is a stack, so it means that things that are 'pushed' (e.g. memory allocated on the stack) last on the stack needs to be 'popped' (freed) first. So, simply having a pointer which points to the top of the stack is enough. That's also the reason why allocating memory on the stack is much faster: you just allocate a certain amount of memory on the top of the stack. No need to search in different memory regions to find a block which is big enough (which is the case when you allocate memory on the heap).
|
|
|
|
|
I rather intended explaining conceptually how the MMU works, not being specific to stack. I was wanting to explain him the usage of placement new (as in the heap) as well, so got slightly messed up.
Thanks for pointing out.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Hi @ all,
After recording sound with the Wave Methods of Windows media Lib, I want to process the data for a RTP Packet.
That´s my problem whereat it is hard to find any good information.
What exactly I have to do with the captured sound?
Must I compress it before i can encode it to G 711 uLaw or what else I Have to do?
Hope anyone here knows about the handling of sound for sending it with RTP.
I record the sound with WAVE_FORMAT_PCM and 8000 SamplesPerSec by 16bitsPerSamlple.
Greetings
Karsten
|
|
|
|
|
You can use the Audio Compression Manager[^] to convert
your PCM samples to G.711.
Mark
*edit* fixed the link!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Are there any examples how to use the ACM?
And the second problem I don´t understand exactly is how I have to make the frames adapted to
the size I need? Also after recording I need frames of 20ms. Can I simply cut 160 Bytes from the buffer?
And after receiving my RTP Packets? Must I assemble the Data from the Packet before I have to playout the buffer?
modified on Wednesday, September 24, 2008 3:41 AM
|
|
|
|
|
CrazyDogg wrote: Are there any examples how to use the ACM?
See the "Using the Audio Compression Manager" section at the link.
CrazyDogg wrote: I don´t understand exactly is how I have to make the frames adapted to
the size I need?
That can get tricky because different codecs have different granularity.
You can easily use the ACM functions to examine different compressed formats
to see if 20ms granularity is possible.
I personally capture samples in 20ms chunks, so yes, you can cut 160 bytes of
samples from the buffer.
CrazyDogg wrote: And after receiving my RTP Packets? Must I assemble the Data from the Packet before I have to playout the buffer?
Yes - you have to. If the samples have been converted to another format
(than PCM) you'll need to convert them back to PCM.
Then you have to deal with jitter, lost packets, and if you're doing
capture/playback in real time (like teleconferencing) you need to
deal with clock drift.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I have an MFC program where the path of a WMV file can be entered. I'm just looking for a simple way to get the number of audio channels from the entered video.
Thanks in advance.
|
|
|
|
|
The Windows Media Format SDK[^] has all the functionality
for working with ASF files (like WMV).
Lots of sample code in the docs!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am developing a dialog based application in MFC. In my application i have a multiline edit box. For that i have added scrollbars. Scrollbars are working in WindowsXP. But if i run my application in WindowsVISTA scrollbars are not appearing for the edit box. Can any one tell me where it is going wrong?
|
|
|
|
|
hari_honey wrote: i have added scrollbars.
Using what code?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I've downloaded free Interbase library - IBPP.
What I must do to use it as <ibpp.h> instead of "..\ibpp\ibpp.h" in my project?
Do I have to move IBPP files from my project folder to ... ?
P.S. I'm new to the C++ scene so if you can write more details of how to do this in MSVS 2005 or DevC++.
Thank you in advance,
Ani
|
|
|
|
|
I didn't fully understand what you were asking but I guess that you want to avoid specifying the full path to the include files in your sources, is that right ? If, yes, you have to specify this in the "additional include directories" option. For VC2005, open the project settings -> "C/C++" -> "General" -> "Additional Include Directories". There add the path to the include dir of the library.
|
|
|
|