Questions tagged [crt]

For issues relating to utilizing the C runtime library.

The C runtime library is a special program library used by a compiler, to implement functions built into the C programming language, during the execution (runtime) of a computer program.

Not to be confused with CRT terminals.

364 questions
3
votes
0 answers

How to use ftell and fseek in an UTF-8 encoded with Visual Studio?

I want to seek back to a known position in a file. Therefore I use ftell to save the position and later I use fseek to get back. I know about the restrictions, to seek to a specific position. But this doesn't apply to my case. I have a known…
xMRi
  • 14,982
  • 3
  • 26
  • 59
3
votes
1 answer

_CrtSetAllocHook never shows filename/line number

I am implementing a memory tracker in my application so that further down the line, should I get any memory leaks I can switch this little guy on to find it. All is great except that I am never passed the filename or the line number. Is there some…
Moo-Juice
  • 38,257
  • 10
  • 78
  • 128
3
votes
3 answers

Does NtDll really export C runtime functions, and can I use these in my application?

I was looking at the NtDll export table on my Windows 10 computer, and I found that it exports standard C runtime functions, like memcpy, sprintf, strlen, etc. Does that mean that I can call them dynamically at runtime through LoadLibrary and…
Vlad
  • 369
  • 4
  • 16
3
votes
1 answer

How to avoid C runtime (crt*.o) garbage

I have two C source files foo1.c: #include #include int main(void) { puts("hello world"); return 0; } and foo2.c: #include #include void _start(void) { puts("hello world"); exit(0); } and…
nebuch
  • 6,475
  • 4
  • 20
  • 39
3
votes
3 answers

How do Microsoft's C++ safe versions of C library functions know the size of static buffers?

While using some of the Microsoft safe versions of many of the standard C library functions I've noticed that some of these functions seem capable of determining at compile time if a passed in buffer is allocated statically or dynamically. If the…
Matt
  • 113
  • 4
3
votes
2 answers

crt1.o error in mips cross compiler

I would like to generate MIPS binaries using gcc on an x86 machine. In order to install MIPS cross-compiler I followed the directions on this page. I could install gcc and binutils successfully. I tried to to compile a simple hello world program…
nlogn
  • 343
  • 4
  • 13
3
votes
2 answers

Does _control87() also set the SSE MXCSR Control Register?

The documentation for _control87 notes: _control87 [...] affect[s] the control words for both the x87 and the SSE2, if present. It seems that the SSE and SSE2 MXCSR control registers are identical, however, there is no mention of the SSE unit in…
IInspectable
  • 46,945
  • 8
  • 85
  • 181
3
votes
1 answer

How to get the LCID from std::locale

In windows how to get the LCID from the std::locale locale l1(".OCP");//get the default system locale cout<
ahmedsafan86
  • 1,776
  • 1
  • 26
  • 49
3
votes
1 answer

LIBCMT.lib: error LNK2001: unresolved external symbol _main

Yes I know there are hundreds of posts about LNK2001 on Stackoverflow already. But NONE of them solved my problem. So I post my solution here. Symptom: An ATL DLL compiles fine as Debug but fails with the above error compiled as Release. Stuck for…
Elmue
  • 7,602
  • 3
  • 47
  • 57
3
votes
2 answers

How to prevent a C or C++ program from using CRT functions?

In my case, I have two layers say core layer and application layer. Application layer depends of core layer. I want that only core layer should use CRT functions. In application layer, if any CRT function is used, it should not compile. Is there any…
doptimusprime
  • 9,115
  • 6
  • 52
  • 90
3
votes
1 answer

How is Linux CRunTime library handled compared to Microsoft

I've been having a lot of conceptual issues with Microsoft's CRT. For any project you have to compile all required libraries to link against the same version of the CRT. The first problem is when your project statically links against the CRT (/MT).…
Budric
  • 3,599
  • 8
  • 35
  • 38
3
votes
5 answers

Regarding vsnprintf (Interview)

During an interview I was requested (among other things) to implement the following function: int StrPrintF(char **psz, const char *szFmt, ...); similar to sprintf, except instead of the already-allocated storage the function must allocate it…
valdo
  • 12,632
  • 2
  • 37
  • 67
2
votes
1 answer

How to properly build third-party library to be used in Debug and Release configurations in my project?

When I need to build some third party library to be used in several of my projects under different version of MSVC, I usually build it for every MSVC version and for both Debug and Release configurations. That's what boost does, and that's what we…
Mikhail
  • 20,685
  • 7
  • 70
  • 146
2
votes
0 answers

Different runtime between Windows accounts

I have a problem on running a windows service on some computers, not all. It's written by VS2008, and needs VC Runtime. I installed the VC Runtime first, then installed the service by Administrator. The service logon user is liwb, in Administrator…
liwb
  • 21
  • 3
2
votes
3 answers

How to provide a 64-bit thread identifier for _beginthreadex

I'm trying to port some code to 64-bit, but it seems that the thread address identifier in _beginthreadex is unsigned int which is 32-bits and I can't pass/receive a 64-bit address identifier from the function: uintptr_t _beginthreadex( // NATIVE…
Kiril
  • 39,672
  • 31
  • 167
  • 226