crt

Does a memory leak at unload of a DLL cause a leak in the host process?

Consider this case: dll = LoadDLL() dll->do() ... void do() { char *a = malloc(1024); } ... UnloadDLL(dll); At this point, will the 1k allocated in the call to malloc() be available to the host process again? The DLL is statically linking to the CRT. ...

_nolock CRT functions

I have recently discovered the existence of _nolock functions, and I am surprised by how little info I can find on these. It says it increases performance, but I can't find any benchmark. It also says they can be used in a multi-threaded program if the program does its own locking, but what has to be locked? Should all CRT calls go throu...

A Beginner's scanf_s() Disability

int main(void) { char tmp, arr[100]; int i, k; printf("Enter a string: "); scanf_s("%s", arr); for ( k = 0, i = (strlen(arr) - 1); k < (int) (strlen(arr) / 2); --i, ++k) { tmp = arr[k]; arr[k] = arr[i]; arr[i] = tmp; } puts(arr); return 0; } I know that there is so...

How can I write a Windows application without using WinMain?

Windows GUI applications written in C/C++ have 'WinMain' as an entry point (rather than 'main'). My understanding of this is that the compiler generates a 'main' function to be called by the C Runtime. This 'main' function sets up the necessary environment for the GUI and calls into 'WinMain' (specifying the instance handles etc.). In s...

VC90 Debug CRT error

I have created a Dll in VC++ 2008. But it is working with some other software (VB). Unable to load that dll function in Labview. VC90 Debug CRT error is coming. Why is this software not supporting my dll? ...

How to build C++ app which runs on plain old XP SP2 with Visual Studio 2008 and no Side-by-Side DLLs?

I'd like to compile a C++ project with just a single call to WinExec in order to launch another executable with some command line parameters. I've no idea what settings to specify in my project in order to get produce an executable that works without requiring Microsoft side-by-side DLLs, which I don't want to have to install on my targe...

How to execute some code before entering the main() routine in VC?

I am reading Microsoft's CRT source code, and I can come up with the following code, where the function __initstdio1 will be executed before main() routine. The question is, how to execute some code before entering the main() routine in VC (not VC++ code)? #include <stdio.h> #pragma section(".CRT$XIC",long,read) int __cdecl __initstd...

Should I compile with /MD or /MT ?

In Visual Studio, there's the compile flags /MD and /MT which let you choose which kind of C runtime library you want. I understand the difference in implementation, but I'm still not sure which one to use. What are the pros/cons? One advantage to /MD that I've heard, is that this allows someone to update the runtime, (like maybe patch...

Should I link to the Visual Studio C runtime statically or dynamically?

I have read arguments on both sides about whether one should link to the C runtime library statically or dynamically in Visual Studio projects, and I'm still not entirely sure what to think. My project pulls in some third-party libraries (Python, HDF5, Trilinos, and Microsoft MPI), each of which has to be built with the same runtime lib...

Windows malloc replacement (e.g., tcmalloc) and dynamic crt linking

A C++ program that uses several DLLs and QT should be equipped with a malloc replacement (like tcmalloc) for performance problems that can be verified to be caused by Windows malloc. With linux, there is no problem, but with windows, there are several approaches, and I find none of them appealing: 1. Put new malloc in lib and make sure ...

how to avoid lnk2005 error in visual studio.

Hi any body plzzzzzz help me to remove linker error 2005. I am vexed with these errors libcmtd.dll msvmrtd.dll some element(ex: _mkdir ) alredy defined like error.. ur support wil greatly help for me. "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo...

How do I use a VBscript to determine if the monitor(s) connected to a machine is an LCD or CRT?

I am trying to add info to a VBscript that will determine if the monitor(s) connected to the current machine is an LCD or CRT. I know I can get the EDID info from HKLM\System\CCS\Enum\DISPLAY but I can't use that to determine the monitor type. And the only consistent info I can grab from the WMI classes Win32_DesktopMonitor, Win32_Disp...

How to statically link to the CRT with GCC?

Using GCC4 in MAC OSX, Linux and Windows. Thanks. ...

What functions does _WinMainCRTStartup perform?

This is part of a series of at least two closely related, but distinct questions. I hope I'm doing the right thing by asking them separately. I'm trying to get my Visual C++ 2008 app to work without the C Runtime Library. It's a Win32 GUI app without MFC or other fancy stuff, just plain Windows API. So I set Project Properties -> Confi...

Building Visual C++ app that doesn't use CRT functions still references some

This is part of a series of at least two closely related, but distinct questions. I hope I'm doing the right thing by asking them separately. I'm trying to get my Visual C++ 2008 app to work without the C Runtime Library. It's a Win32 GUI app without MFC or other fancy stuff, just plain Windows API. So I set Project Properties -> Confi...

MFC CRT Order Linker Problem

Hey there! I have exactly the problem described here (i'm getting those linker errors when trying to add MFC to my project): http://support.microsoft.com/?scid=kb%3Ben-us%3B148652&amp;x=8&amp;y=9 however - if I follow the solution and enter nafxcwd.lib; libcmtd.lib into 'ignore libraries' as well as 'additional dependencies', then i'll...

Statically linking against library built with different version of C Runtime Library, ok or bad?

Consider this scenario: An application links to 3rd party library A. A is built using MSVC 2008 and is statically linking (ie. built with /MT) to the C Runtime Library v9.0. The application is built using MSVC 2005 and is statically linking to A and (using /MT) to the C Runtime Library v8.0. I can see trouble with this - for instance ...

What is the reason of _tcs prefix for common string functions in Visual C?

Visual C++ CRT has several _t prefixed functions for both unicode and Ansi compatibility in the same source. So strcmp becomes _tcscmp, which I could never remember easily. So what is the hungarian notation meaning of _tcs and why Microsoft choose the way it is now instead of just simple prefixing, like strcmp -> _tstrcmp ? ...

Side by Side error running Qt Creator

On Vista Ultimate (No SP), I installed Qt Creator 1.3 from Nokia, using the Windows Binary installer. When I tried running it, I got a side-by-side error saying: "The Application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail." The Event Viewer Logs showed: "...

Directing a VC++ app to use older VC80.CRT version

Hello, I have a VC++ managed app that was built and tested against VC80.CRT version 8.0.50727.762. I verified that the embedded manifest points to 762, and the build machine has 762 as the latest VC80.CRT version. The app has now been also run on a machine that has both 762 as well as a later version of the runtimes (4053). Both mac...