|
rbwest86 wrote: sizeof volumetotal
sizeof volumetotal is always 8 whatever value it contains (in the range allowed for double s, of course, see [^]).
Adding values to volumetotal cannot change its size in memory (it changes just the bit pattern in memory).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: is always 8 a constant, often 8
FTFY
The good old Data General machines had 36-bit words holding five 7-bit bytes plus a flag bit, so they would store a double in slightly more than 10 bytes. Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Klingon developers aren't allowed to talk with someone who thinks there are 7 bits bytes. 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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Klingon developers aren't allowed to talk with someone who thinks there are 7 bits bytes.
If that is true, you've just proven yourself not to be a Klingon developer. Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
thank you everyone. I figured out what the problem was.
Thank you all again.
|
|
|
|
|
I want to realize the toolbars and windows as follows:
but I only get this result now:
how to do it?
anyone can tell me the answer?
Thanks a lot!
|
|
|
|
|
|
Thank you!
I download the VC2008FeaturePack.exe(322M),but can't install.
I use the chinese version, the System Requirements says:
"Support for systems with non-English versions of Visual Studio 2008 installed will be available in Visual Studio 2008 Service Pack 1. "
So I download the VS2008SP1CHSX1512981.iso(898M), It's too big to install. It need 6G disk space to install. but I have only 4G in my C: disk
Other BBS friends advice me to use:
1. Xtreme Toolkit Pro
2. WTL
3. DirectUI
I don't know these, but I'll try all above.
This is it. Anyone else has other advices?
|
|
|
|
|
Hiya,
I want to basically perform a bulk copy to a SQL server remotely via VC++ client.
Just dont know what library to pull in,maybe sqlncli.msi and use the sqlncli.dll (sql 2008 native client).
I wanted to build an MFC application to use this dll. I'm not sure if this is what I want and how to use
it. Guidance is needed on this and a steady hand.
Much appreciated if somebody can shed some light on how to do this in VC++?
Thanks,
garyc
|
|
|
|
|
Sql native client should do, install it and look for examples.
OLEDB and ODBC providers are good as well, look here http://msdn.microsoft.com/en-us/library/ms130809.aspx
|
|
|
|
|
Hi everyone.
I've got a code snippet which looks like this
CInternetSession session(_T("MyAgent"));
CHttpConnection *pConn = NULL;
pConn = session.GetHttpConnection(_T("www.google.com"),
(INTERNET_PORT)INTERNET_DEFAULT_HTTP_PORT); // function in wininet.dll
......
delete pConn;
The last delete operator works fine. The problem is that it shouldn't, because the exe from which I call wininet.dll function is linked with CRT statically, so the delete operator should look for pConn in it's CRT's run time heap and shouldn't find it. Please share any ideas.
Thanks in advance.
|
|
|
|
|
here's the source for CInternetSession::GetHttpConnection:
CHttpConnection* CInternetSession::GetHttpConnection(LPCTSTR pstrServer,
DWORD dwFlags, INTERNET_PORT nPort ,
LPCTSTR pstrUserName , LPCTSTR pstrPassword )
{
ASSERT(AfxIsValidString(pstrServer));
ASSERT((dwFlags & INTERNET_FLAG_ASYNC) == 0);
CHttpConnection* pReturn = new CHttpConnection(this, pstrServer,
dwFlags, nPort, pstrUserName, pstrPassword, m_dwContext);
return pReturn;
}
it's allocated on the caller's heap, not in WinInet.DLL
that's in VC6's MFC\SRC\Inet.cpp
|
|
|
|
|
Tnank you very much for your reply, but please take a look at this text whick I took from Jeffrey Richter's "Windows via C++"
VOID EXEFunc() {
PVOID pv = DLLFunc();
// Access the storage pointed to by pv...
// Assumes that pv is in EXE's C/C++ run-time heap
free(pv);
}
PVOID DLLFunc() {
// Allocate block from DLL's C/C++ run-time heap
return(malloc(100));
}
So, what do you think? Does the preceding code work correctly? Is the block allocated by the DLL's function freed by the EXE's function? The answer is: maybe. The code shown does not give you enough information. If both the EXE and the DLL link to the DLL C/C++ run-time library, the code works just fine. However, if one or both of the modules link to the static C/C++ run-time library, the call to free fails. I have seen developers write code similar to this too many times, and it has burned them all...
|
|
|
|
|
the code i posted above is the code that you are calling. the object you are deleting is allocated by your app's CRT.
the DLL/EXE CRT allocation issue is not relevant here.
|
|
|
|
|
Thank you for your reply, please take a look at my reply to Richard in the next thread.
|
|
|
|
|
naro24 wrote: so the delete operator should look for pConn in it's CRT's run time heap
Library functions do not have their own heap. The heap is allocated at run time and shared by the exe file and all library functions.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Tnank you very much for your reply, but please take a look at this text whick I took from Jeffrey Richter's "Windows via C++"
VOID EXEFunc() {
PVOID pv = DLLFunc();
// Access the storage pointed to by pv...
// Assumes that pv is in EXE's C/C++ run-time heap
free(pv);
}
PVOID DLLFunc() {
// Allocate block from DLL's C/C++ run-time heap
return(malloc(100));
}
So, what do you think? Does the preceding code work correctly? Is the block allocated by the DLL's function freed by the EXE's function? The answer is: maybe. The code shown does not give you enough information. If both the EXE and the DLL link to the DLL C/C++ run-time library, the code works just fine. However, if one or both of the modules link to the static C/C++ run-time library, the call to free fails. I have seen developers write code similar to this too many times, and it has burned them all...
|
|
|
|
|
naro24 wrote: Is the block allocated by the DLL's function freed by the EXE's function? The answer is: maybe.
Actually the answer is "Yes". As I said earlier there is only one heap within a running application. Whether the actual code is part of the EXE or part of the DLL is irrelevant, the OS maps both parts into the same address space and they all share the same data area within that address space. If this was not so then 99% of commercial applications would not work correctly.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thanks for your reply, but let me to disagree with you.
Richard MacCutchan wrote: As I said earlier there is only one heap within a running application.
An application can actually create and use as many heaps as needed using HeapCreate,HeapAlloc,HeapFree and other APIs.
Richard MacCutchan wrote: Actually the answer is "Yes"
The answer is not always "Yes". I tested the following code in vs2005
int main()
{
int* a = fnHeapTestLib();
std::cout<<*a<<std::endl;
delete="" a;
="" std::cout<<*a<<std::endl;
="" return="" 0;=""
}
heaptestlib_api="" int*="" fnheaptestlib(void)
{
="" p="new" int;
="" *p="42;
" p;
}
i="" built="" in="" release="" version="" using="" 4="" different="" configurations,="" and="" here="" are="" the="" results
1)both="" exe="" dll="" linked="" to="" crt="" dynamically
="" works="" fine
2)exe="" is="" statically,="" fine(="" very="" strange="" fact="" )
3)exe="" dynamically,="" statically
="" fails(shows="" same="" value="" after="" before="" delete,="" debug="" raises="" assertion)
4)both="" assertion)
i="" can't="" explain="" this="" behavior,="" but="" makes="" obvious="" that="" allocation="" issue="" relevant="" here.
<blockquote="" class="FQ">Richard MacCutchan wrote: If this was not so then 99% of commercial applications would not work correctly.
May be 99% of commercial applications and their DLLs link to CRT dynamically.
Regards
|
|
|
|
|
naro24 wrote: delete fails(shows the same value after and before delete, in debug version raises assertion)
The delete operation does not clear the contents of the memory, so testing the contents before and after is not a valid test. When a block is deleted its header is merely marked to show it is available for reallocation within the running program. As to your comments about HeapCreate() etc, if they work as you believe then I am certain that many commercial programs would be failing on a regular basis. Take a look at the documentation for these functions.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Could you please make this small test in vs2005 or vs2008
1)Make an exe and dll using the code in my previous post
2)Make both projects link to CRT statically
3)Build both in debug mode
As you claim everything must work properly, but you'll see an assertion on delete operator. Can you explain why?
|
|
|
|
|
Unfortunately I only have VC++ Express so I cannot reproduce completely. However, I think I finally understand what you are saying, and I would suggest it is wrong to link a system library to a dll statically, since this will cause the problems you are seeing. Your program now has two copies of the CRT attached to it and so all bets are off, you will get inconsistent results, as is to be expected. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
no answers for you here - but you should google "sms gateway"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Hi ALL,
I am using MS Visual Studio 2008 to develop a MFC application.When compiling i am getting the following errors.Please help me fix these.
Error 14 error LNK2005: __wfopen already defined in libcmt.lib(wfopen.obj) MSVCRT.lib USMIF
Error 15 error LNK2005: _fclose already defined in libcmt.lib(fclose.obj) MSVCRT.lib USMIF
Error 16 error LNK2005: _fread already defined in libcmt.lib(fread.obj) MSVCRT.lib USMIF
Error 17 error LNK2005: _fwrite already defined in libcmt.lib(fwrite.obj) MSVCRT.lib USMIF
Error 18 error LNK2005: _fseek already defined in libcmt.lib(fseek.obj) MSVCRT.lib USMIF
Error 19 error LNK2005: _ftell already defined in libcmt.lib(ftell.obj) MSVCRT.lib USMIF
Error 20 error LNK2005: _fflush already defined in libcmt.lib(fflush.obj) MSVCRT.lib USMIF
Error 21 error LNK2005: _feof already defined in libcmt.lib(feoferr.obj) MSVCRT.lib USMIF
Error 22 error LNK2005: _ferror already defined in libcmt.lib(feoferr.obj) MSVCRT.lib USMIF
Error 23 error LNK2005: _free already defined in libcmt.lib(free.obj) MSVCRT.lib USMIF
Error 24 error LNK2005: _calloc already defined in libcmt.lib(calloc.obj) MSVCRT.lib USMIF
Error 25 error LNK2005: __swprintf already defined in libcmt.lib(swprintf.obj) MSVCRT.lib USMIF
Thanking in advance ,
ashwath
|
|
|
|