|
If your problem is that your application fails because over time this library keeps consuming memory then the solution is to remove the library from your application. You can do that as follows.
1. Create an executable that wraps the library.
2. Provide a communication idiom: files, stdio or sockets. That provides the necessary API for your business needs (basically a proxy for what you are already doing.)
3. In your actual application use WinProcess (or whatever the method is called) to execute 1 and manage it.
4. Use the communication from 2 from your application in place of the straight to library calls you are currently using.
Other variations on the above depend on your needs
- Create multiple instance
- Stop each instance after X (1 or more) uses
- Have min/max instances and use a locked queue to send requests for processing
- Detect failures, restart and retry a request.
- Detect excessive memory usage, terminate and restart.
|
|
|
|
|
Thank you for the specific suggestions. i will have a try.
|
|
|
|
|
I want to convert a binary file (.dll) to a base64 string and store it in my application, then write it to the hard disk using the stored base64 string but i am failing miserably. any help is appreciated thanks.
edit: basically, exactly what this site does: http://www.motobit.com/util/base64-decoder-encoder.asp[^]
|
|
|
|
|
base64 conversion is actually simple, you shouldn't fail. However you may also find ready-to-use implemantations, for instance, a quick Google search gave me: "Encoding and decoding base64 with C++"[^].
Veni, vidi, vici.
|
|
|
|
|
Member 8417954 wrote: but i am failing miserably. any help is appreciated thanks. It's impossible to help unless you explain exactly what the failure is. You might also like to explain exactly what problem you are trying to solve, as this seems a rather pointless exercise.
Use the best guess
|
|
|
|
|
CString ftitle;
fscanf_s(f_ptr_seed_inf,"%s\n",ftitle[ifl].GetBuffer(MAX_PATH));
ftitle[ifl].ReleaseBuffer();
I got error message:
Unhandled exception at 0x776015de in MSW_Vib_Model.exe: 0x00000000: The operation completed successfully.
Please help
|
|
|
|
|
Try taking out the [ifl] from the ftitle object. I don't think you can call GetBuffer() on a character returned from the [] operator.
CString ftitle;
fscanf_s(f_ptr_seed_inf,"%s\n",ftitle.GetBuffer(MAX_PATH));
ftitle.ReleaseBuffer();
|
|
|
|
|
|
mrby123 wrote: fscanf_s(f_ptr_seed_inf,"%s\n",ftitle[ifl].GetBuffer(MAX_PATH)); How does this even compile? I would have expected a C2228 error.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
As Richard said, I've already answered this question.
You need to change the fscanf_s line as follows -
fscanf_s(f_ptr_seed_inf,"%s\n",ftitle[ifl].GetBuffer(MAX_PATH), MAX_PATH);
|
|
|
|
|
I have read a lot about abstract class, but still have questions, as I have not really used in my c++ code practically.
What is the use of abstract class ? Any sample I can take a look at ?
Thanks.
|
|
|
|
|
|
AdvancedCPP wrote: What is the use of abstract class ?
class Shape
{
public:
Shape( int nWidth, int nHeight )
{
m_nWidth = nWidth;
m_nHeight = nHeight;
}
virtual double getArea() = 0;
protected:
int m_nWidth;
int m_nHeight;
};
class Circle : public Shape
{
public:
Circle( int nWidth, int nHeight ) : Shape(nWidth, nHeight) {};
double getArea()
{
int nRadius = m_nWidth / 2;
return 3.1415962 * nRadius * nRadius;
}
};
class Square : public Shape
{
public:
Square( int nWidth, int nHeight ) : Shape(nWidth, nHeight) {};
double getArea() { return m_nWidth * m_nHeight; }
};
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
One of the points of an abstract class is you'd never create one (e.g. shape in example) - you can't create a 'shape' (what would it look like?) it has to be a circle or a square (as in the example) or some other real thing. But you do create objects that inherit from (use the code in) an abstract class. So the advantage is you only have to write the abstract class code (shape in the example) once, no matter how many different actual concrete classes which inherit the class, you can create such as square, circle etc all which inherit from it.
|
|
|
|
|
AdvancedCPP wrote: I have not really used in my c++ code practically
You have either to change that or your nickname.
Veni, vidi, vici.
|
|
|
|
|
I am creating an application that is multithreaded and all the threads are accessing the same shared memory. The data coming into the memory should be processed in sequential order. Like if 1,2,3,4,5 comes in the memory then it should be processed in same order.
I have used critical section around my memory, but I still get into a race condition where data is not grabbed by the thread in sequential order.
Am I missing anything else to prevent threads from race condition?
Thanks.
ACpp
|
|
|
|
|
Yes, you are.
Google 'multi thread patterns'.
It is a long path, but when you arrive, you're likely to feel it was worth it.
Pablo.
"Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, circa 1899).
|
|
|
|
|
Can I run two command line instructions on a file in a VS2008 project? I can set each command line instruction up as a rule in the .rules file (see below) but can only select one rule or the other not both. From the input files properties in VS2008 Project View I can select GraphVizSVGRule or GraphVizPNGRule . I want to create both a .svg file and a .png file from the input .gv file (GraphViz)
="1.0"="utf-8"
<VisualStudioToolFile
Name="GraphViz Rule File"
Version="8.00"
>
<Rules>
<CustomBuildRule
Name="GraphViz Dot to SVG Rule"
DisplayName="GraphVizSVGRule"
CommandLine="dot.exe -T svg "$(InputDir)\$(InputName).gv" -o "$(InputDir)\images\$(InputName).svg""
Outputs="$(InputDir)\images\$(InputName) .svg"
FileExtensions="*.gv"
ExecutionDescription="builds svg file"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="GraphViz Dot to PNG Rule"
DisplayName="GraphVizPNGRule"
CommandLine="dot.exe -T png "$(InputDir)\$(InputName).gv" -o "$(InputDir)\images\$(InputName).png""
Outputs="$(InputDir)\images\$(InputName) .png"
FileExtensions="*.gv"
ExecutionDescription="builds png file"
>
<Properties>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>
|
|
|
|
|
The only method I have found to run more than one is to create a command script that accepts parameters, so you can pass in the file and directory names.
Use the best guess
|
|
|
|
|
Thanks, it's now working with the below as you suggested.
Rule that calls batch file:
<CustomBuildRule
Name="GraphViz Dot to PNG and SVG"
DisplayName="GraphVizPNGSVGRule"
CommandLine="images "$(InputDir)\$(InputName).gv""
Outputs="$(InputDir)\images\$(InputName).png;$(InputDir)\images\$(InputName).svg;"
FileExtensions="*.gv"
ExecutionDescription="builds png and svgfile"
>
<Properties>
</Properties>
</CustomBuildRule>
Batch file that creates svg and png from GraphViz gv file:
echo off
set "p=%~dps1"
set "px=Images\"
set "newp=%p%%px%"
set "newsvg=%newp%%~n1%.svg"
set "newpng=%newp%%~n1%.png"
set "source=%~s1"
echo Creating svg...
dot.exe -T svg %source% -o %newsvg%
echo Creating png...
dot.exe -T png %source% -o %newpng%
|
|
|
|
|
Hello Friends
Application is Compiled on VS2010 in WinXp and it is crashing on Win8 when ivoked by Menu not crashing by shortcuts.
Isn't issue with running application on 64 bit Machine ?
Reagrds
Y
|
|
|
|
|
You are not really providing us with enough information here and I am not sure I understand the difference between launching the application from a menu versus from a shortcut.
However, I think it could be because the shortcut is setting the applications startup folder to be the installation folder, whereas that is not being done when it is launched from the menu.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
modified 7-Jun-13 7:32am.
|
|
|
|
|
You will need to provide a lot more information than the above if you want some assistance. Try getting some debug information and show the failing code.
Use the best guess
|
|
|
|
|
I am opening a simple Dialog on Menu->SubMenu And also using keyboard Shotcut too.
But, When I Click on Ok of that Dialog ,it completes its execution and then go to Dissembly.
But If I do same process using Keyboard shortcut then everything is fine.
|
|
|
|
|
I see that I guessed completely wrong when I thought I understood what you were saying. You can disregard my answer as it obviously has nothing to do with that.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|