Hi, here If I repeat load library in VC: HMODULE handle0 = LoadLibrary(TEXT("testdll0.dll")); HMODULE handle1 = LoadLibrary(TEXT("testdll0.dll")); My program will load the two copies of the testd110.dll in memory? handle0 should be equal to handle1? Thanks a lot!
Best Kiluyar
Posts
-
About dll dynamic load - a simple question? -
How to catch unhandled exceptions?Hi, I have an old program without and try/catch statements. Now I'm trying to handle some exceptions . However, I don't want to add any try/catch pieces in the code - it's big work. So, I hope to use a API: SetUnhandledExceptionFilter() to handle all exceptions and jump into my handle function. However, the handle function must return one of these: EXCEPTION_EXECUTE_HANDLER EXCEPTION_CONTINUE_EXECUTION EXCEPTION_CONTINUE_SEARCH This is boring, the exception will still be thrown. I hope to hide exception in my filter handle function. How can I do that?
-
Local static variable is thread safe?Of course, I want to do a shared function by all thread. However, I hope to only have one synchronization in this function. I means, the first thread entered the synchronize, all following thread return the reference of object directly.
-
Local static variable is thread safe?So, how to make it safe? Use thread mutex: ? A& foo() { Wait_Mutex(...); static A a; Release_Mutex(...); } ?? This looks very bad performance!:)
-
Local static variable is thread safe?I don't means different class. For example: class A { public: A(){...//some operations} }; void main() { Create_Thread(foo()); Crteae_Thread(foo()); } Is this safe?:)
-
Local static variable is thread safe?I have such a function: template T& GetInst() { static T t; return t; } I'm not sure whether this is thread safe? If T's constructor has many operations, when two thread entered this function early and later, is there such scenario: the first thread is in T's constructor's, the second thread define t again?:)
-
Exception code: c0000090 (FLT_INVALID_OPERATION) - I am in despair!I'm working on a fatal error which make our application crash! I can not reproduce it in my environment, so I tried to get the Dr.Watson's dump log and it indicate such error: 380861d0 da742430 fidiv dword ptr [esp+0x30] ss:00c0977f=a0b900c1 FAULT ->380861d4 d95e58 fstp dword ptr [esi+0x58] ds:00c0983a=c1eed825 I have found the code corresponding to the asm instruction: i = float (m_rect.Width()) / float(m_rect.Height()); Just two floats' division! X| I'm sure denominator is not Zero! I can not understand why the fstp give such a fatal message: Exception code: c0000090 (FLT_INVALID_OPERATION) Who can give me advices? Thanks a lot, a lot...
-
Dr. Watson crashThanks. Moonen. But I don't have any other debugger tools. Do you know what can I used to replace Dr. Watson?:sigh:
-
Dr. Watson crashHi, I'm working on windows2000 with SP4. My application crashed when running. The developer ask me to open Dr.Watson for this application and send dump file to him. However, after run "drwtsn32 –p PID" (My application's PID), Dr. Watson crashed! So I can not get whole dump file. I just see such error from Dr. Watson's log: App: (pid=2096) When: 4/10/2007 @ 15:58:17.609 Exception number: 80000003 (hardcoded breakpoint) I feel very boring and don't know the reason:( X|
-
Help me! Why my dll export lots of symbols which I dont want?Hi, I'm building a dll which export some interfaces. I use a .def file to set export symbols. But, after build, while using VC tool "depends" to watch export symbols, I see lots of additional functions which not defined in my .def file! My dll also link some thridparty libs which implement these additional functions. Do you know the reason and how to resolve it? :sigh:
-
How to watch the objects value in a STL container in VS2003? Such as VectorHi, all I'm debugging a program which use lots of STL container such as vector, list, etc. in VS2003 and meeting a very boring problem: I can not see the objects values, such as, all int values in a int vector, in VS debug watch window! I can only see the size of a container. I had to print all values one bye one. This is so inconvenient to make my work process slower. Do you have any ideas? Thanks a lot!:) Remy Zhu
-
How to share data in a same dll loaded by different process?Hi, :) I write a dll which will be loaded by different application. Currently, I need to share some data between the same dlls loaded in different processes. How can I do? Is there a simple way? I consider to use a file to stored the data shared. But I must write/read the data frequently. So I think use file is not a good way.
-
How to set array parameter in Sybase ASE stored procedure?Hi, I need to set mutiple values parameter in Sybase ASE stored procedure. I don't know whether Sybase support array type parameter and how to set it.:confused:
-
How to output UTF-8/UTF-16 string in VS?;P;P;PHi, I'm dev in China. I want to output some string of Chinese in unicode format(UTF-8/UTF-16). So in VS2003, I write code like this to test: int _tmain(int argc, _TCHAR* argv[]) { _TCHAR* buffer = L"汉"; unsigned char* uP = (unsigned char*)buffer; return 0; } I found that the pointer 'uP' have this value: uP : 186 (BA) uP+1: 0 uP+2: 186 (BA) uP+3: 0 The unicode of '汉' is: 6C 49 The Chinese code page (GBK) in windows of '汉' is : BA BA So, the internal code in program only extand BA to BA 00 I test the code in VS2005 again, however, the internal code became 6C 49, is correct. I don't know why.:(( Remy Zhu
-
Help me ! Question for variables in stack!:-DI write code such as following in Visual C++ 6.0: #include "stdafx.h" int main(int argc, char* argv[]) { char c0; double d0; char c1; char c2; printf("%p\n%p\n%p\n%p\n",&c0,&d0,&c1,&c2); return 0; } In Debug build mode, output: 0012FF7C 0012FF6C 0012FF78 0012FF74 Why VC6 put variable d0 on the stack top? Your sincerely REMY
-
Hi,How to understand Visual C++ stack alignment?Dear Experts, I test such code in Visual C++ 6.0 as following: #include #include int main() { char c0; char c1; char c2; printf("%p\n%p\n%p\n",&c0,&c1,&c2); return 0; } In "DEBUG" build mode without optimizationm, the output is : 0012FF7C 0012FF78 0012FF74 In "RELEASE" build mode without optimization, the output is : 0012FF7C 0012FF78 0012FF74 In "RELEASE" build mode with "Maxmize Speed" optimization, the output is: 0012FF7D 0012FF7E 0012FF7F So, as above, in stack, there are redundant bytes in these "char" variables. Why? Why Visual C++ compiler insert redundant bytes into stack? :confused: Your Sincerely REMY
-
How to close a COM Server Process from Client? Thank you!Thank you! Steve I wanted to know more about the auto-ending of Server. I created a ATL EXE COM SERVER and used a client to conneted and disconnected it. After a moment, in system process list, the ATL EXE process disappeared. But, I didn't know when the CoSuspendClassObjects was called. Could you tell me more details. I'm learning COM/ATL. Thank you very much! Sincerely REMY:)
-
How to close a COM Server Process from Client? Thank you!Yes. I wrote the 'Release' member for COM SEVER just as following: ULONG CExeComServerConsole0_0::Release() { long nRefCount = InterlockedDecrement(&m_nRef) ; if (nRefCount == 0) delete this; return nRefCount; } But, How can I teminate the server process?:):):):)
-
How to close a COM Server Process from Client? Thank you!:-OHi, all experts: I tried to create a COM local server and a client using win32 console application winzard in VC++ 6. When the client started up, it active the server automatically. The client also connected to server and called interface functions successfully. :((But, how can I terminate the server from client, before the client ended itselt?:^) Thanks a lot!:):):-D:-D REMY
-
Help Me! Thank you very much!Hello, Bio. Thank you very much! By your suggestion, I found my mistakes. In my resource header file "resource.h", I set following macro: #define IDR_TYPELIB 199 But, I forgot to add this to file name. I add your statement: ........ GetModuleFileName(hInstance, ansiPath, MAX_PATH); strcat(ansiPath,"\\199"); MultiByteToWideChar(CP_ACP, 0, ansiPath, strlen(ansiPath) + 1,module, MAX_PATH); ....... Problem resolved ! Thank you again. Thank you very much! Your sincerely Remy (smallbluedemon)