Category "c"

Linking EFI application with LLVM on MacOS

I'm attempting to cross-compile and link a very simple EFI application that is using the EFI headers from the Zircon kernel. Despite my best efforts, I am unabl

ARM Cortex-M4: Running code from external flash

Is it possible to separate base FW and application code on ARM Cortex-M4 architecture (e.g STM32 F4). What I´d like to do is to run applications from exte

How do I access the `addr2line` functionality within my C++ program?

I need to get the information provided by addr2line (source file and line from backtracing a function call) from within a C++ program. I know I can call addr2li

how does fscanf works with different variable types?

I was looking at the MSDN documentation for fscanf. I tried changing the sample code in the documentation, but it didn't work as I expected. If, for example, I

visual studio unallocted pointer not NULL

I've encounter an issue in Visual Studio which drives me crazy. It is regarding unallocated pointers. I wanted to write a simple linked list app.The problem is

Program for finding nth root of the number without any external library or header like math.h

Is there any way to find nth root of the number without any external library in C? I'm working on a bare metal code so there is no OS. Also, no complete C is th

Configuring for a compiler different than the default while running configure

I am compiling the glibc library. Before I could do that, I need to run configure. However, for compiling glibc, I need to use the gcc compiler which is not the

Implementation of FMOD function

How is the fmod function implemented? I tried the following: #include <stdio.h> #include <math.h> float floatMod(float a, float b) { return (a/

Compare Matrix Multiplication Execution Time in Different Sizes in C

I need to calculate and compare execution time of multiplication of 2 matrices in 3 different sizes (100 * 100 , 1000 * 1000 and 10000 * 10000) in C programming

can we use poll function with unnamed pipes?

I am trying to write a program where i need to monitor ends of unnamed pipe for certain events. Can I use unnamed pipes with poll function? If yes, can you plea

How do I fix undefined reference to _imp__*?

I'm trying to compile something that depends on gtkspell, which depends on enchant, under MinGW. I'm getting errors like gtkspell/gtkspell.c:757: undefined r

Linux: buddy system free memory

Could anyone explain this code? page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1); page_to_pfn() have already return the page_idx, so what does

Unexpected Program exit with Code 0xC0000417 (Invalid C-Runtime Parameter)

After upgrading a big project to Visual Studio 2013, the program cased a crash (Program stopped working) on a normal computer. Now when I debug this program in

How can I multiply 64 bit operands and get 128 bit result portably?

For x64 I can use this: { uint64_t hi, lo; // hi,lo = 64bit x 64bit multiply of c[0] and b[0] __asm__("mulq %3\n\t" : "=d" (hi), "=a" (lo)

What is the use of CLOCK_REALTIME?

I am reading about the difference between CLOCK_REALTIME and CLOCK_MONOTONIC Difference between CLOCK_REALTIME and CLOCK_MONOTONIC? The CLOCK_REALTIME has dis

Linux Kernel Module - Create Directory

I've got a problem about creating a directory within a linux kernel module. What I want: Creating a directory within a kernel module. Here is my actual code:

clang linker error when compiling simple C program on OS X

I was building this code from this article I was using the recommended command to build it: gcc -Wall -o keyboard_leds keyboard_leds.c -framework IOKit -framewo

Does Unary + operator do type conversions?

Till now I was believing that there is no use of unary + operator. But then I came across with following example: char ch; short sh; int i; printf("%d %d %d",s

Best approach to mock hiredis library in C

I am writing a project that takes advantage of the hiredis redis client library. What is the best approach to mock this library for use in writing tests? For

Unable to compile XINU source code after adding a new function in assembly language

I have added a file function.S in sys folder in XINU. .text .globl zfunction zfunction: <x86 code> equivalent C code for this function is long