|
You are right, the code in my server was wrong. Up until now it only had code to handle a GET and this incorrectly handled POST. It got a packet with the "complete" headers which for a GET is the end of the story. For a POST there maybe a BODY still to come. It was simply a matter of updating the logic to correctly determine the end of the POST request.
|
|
|
|
|
I am developing a COM based exe that needs some already available functionality ( which exists in the form a static library using MFC ( MFC statically linked ) ). The API's exposed by the static library use primitive data types such as int , unsigned char etc .
However when I include the static library in the COM project, it gives me a linker error about some CString's used .
This is how the code is organized
static library header file mystatic.h
int LibFunc1( int in, char *out) ;
static library source file mystatic.cpp
int LibFunc1( int in, char *out) <br />
{<br />
<br />
.. <br />
CString s = "Hello"; <br />
}
Com Component using static library
#include "mystatic.h"<br />
<br />
<br />
..<br />
..<br />
LibFunc1(x, y)
I am wondering if there is a better way of re-using this as I dont want to rewrite the static library logic .
Help is appreciated.
Engineering is the effort !
|
|
|
|
|
What version of MFC is the library linked with?
If CString is the only class you use, it's no longer part of MFC,
and can be used without MFC.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
MFC 4
Engineering is the effort !
|
|
|
|
|
I have stated CString as an eg however the static library uses other classes such as CStringArray , CArray etc
Engineering is the effort !
|
|
|
|
|
Cool.
What are the exact linker errors?
From the code you've shown, the COM module shouldn't know
anything about a CString in the library code.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Suppose two processes are communication through Namedpipes and one of them gets killed.
Then how will the first process come to know that second process got killed.
Any kind of help would be welcome.
|
|
|
|
|
A read or write on the pipe will fail.
I would guess the error will be ERROR_BROKEN_PIPE...test it
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm working with directX and I have noticed that this function take some time to complete.
150 calls for this function take several seconds (3 seconds).
Is there any way to make this faster ?
|
|
|
|
|
I never used DirectX myself but I suppose that it is a normal behavior. I suppose that the function will load data from the file, which is always a "slow" process. Do you need to load 150 different images ? Because then your software is not very optimized. The best way to tackle this is to use a unique resource manager (make it a singleton for example) from which you will load your textures. The manager will cache the textures internally so that later, if the same texture is needed, it is returned directly, no need to reload the file once again. This has another big advantage: you just have one copy of the same texture in memory (instead of having 150 instances of the same texture, which of course takes a LOT of memory).
Hope that helps.
|
|
|
|
|
Thank you. I'll probably do something similar.
Anyhow my suspicion was that there may some other way to create the IDirect3DTexture from file which will be more faster. like some other function or specify some arguments since my use of the texture is very specific and perhaps not require all the smart things that gets computed when I call D3DXCreateTextureFromFile().
|
|
|
|
|
Hanan888 wrote: like some other function or specify some arguments since my use of the texture is very specific and perhaps not require all the smart things that gets computed when I call D3DXCreateTextureFromFile().
Anyhow, file access is slow. So, that will probably the main reason of the slowness, even if you could remove all the 'smart things' (and I don't there are a lot). And as I said before, you cannot load this same file 150 times in memory, especially if the image is big. It's totally inneficient and you will consume a lot of memory for nothing.
Are you developing a game ? In all games, a resource manager for this kind of stuff is required.
|
|
|
|
|
I do develop a game and your advice is totally currect, and will be implemented, by me I guess...
I'll just make that loading work only once and during times that the user won't notice.
Although it's a lot of files, these are relatively light-weight images, and only the loading time takes some CPU time effort.
It just happened that one of us raised that question (raised doubt on the specific function call), to make things as efficient as possible.
Thank you very much, and I wish I could help back sometime...
|
|
|
|
|
Same think I don't use directX, but reading the Documentation[^] :
For the best performance when using D3DXCreateTextureFromFile:
1. Doing image scaling and format conversion at load time can be slow. Store images in the format and resolution they will be used. If the target hardware requires power of two dimensions, create and store images using power of two dimensions.
2. Consider using DirectDraw surface (DDS) files. Because DDS files can be used to represent any Direct3D 9 texture format, they are very easy for D3DX to read. Also, they can store mipmaps, so any mipmap-generation algorithms can be used to author the images.
|
|
|
|
|
Thank you.
That stuff might speed things up but require me some work to test if it really worth the effort.
|
|
|
|
|
Hello board,is there a function to convert for example "0xFF" or "0F" to their corresponding int 255,16 ? I couldn't find a function like atoi so how should I do that?
thanks.
|
|
|
|
|
Have you considered strtol() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks a lot david, you solved the problem.
|
|
|
|
|
strtol [^] function, called with base=16 , does the magic, for instance:
char * szHex = "0F";
char * szStop;
int i;
i = strtol(szHex, &szStop, 16);
printf("%s hex = %d dec\n", szHex, i);
Please note the output of the program:
0F hex = 15 dec
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
|
Hi all,
could somebody help me with following i need to call an external exe i.e of IDL in my MFC project it should work as in at end of my acquisation code i should be able to call this analysis exe of IDL and also for info IDL saves exe in *.sav format.
any help is greatly appreciated.
Thank you
Dipen
|
|
|
|
|
sunny.rana wrote: could somebody help me with following i need to call an external exe i.e of IDL in my MFC project it should work as in at end of my acquisation code i should be able to call this analysis exe of IDL and also for info IDL saves exe in *.sav format.
any help is greatly appreciated.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I'm really not at all sure what you're asking but if you need to call an external executable have a look at the documentation for ShellExecute. This link[^] might help.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
sunny.rana wrote: ...i need to call an external exe
Do you need this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
While we're guessing at what you're asking (acquisition code ) - I'm going to guess you mean during the build process. I which case, there are boxes for things to do pre- and post-build in the project properties.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|