Questions tagged [c-libraries]
63 questions
17
votes
3 answers
Is the %zu specifier required for printf?
We are using C89 on an embedded platform. I attempted to print out a size_t, but it did not work:
#include
int main(void) {
size_t n = 123;
printf("%zu\n",n);
return 0;
}
Instead of 123, I got zu.
Other specifiers work…

Trevor Hickey
- 36,288
- 32
- 162
- 271
16
votes
3 answers
Is there a performance degradation / penalty in using pure C library in C++ code?
I saw this link but I'm not asking for a performance degradation for code using "extern". I mean without "extern", is there "context switching" when using C library in C++?
Are there any problems when using pure C (not class-wrapped) functions in…

John Doe
- 283
- 3
- 10
10
votes
1 answer
Why is the Postgres C library called libpq instead of libpg?
Everything in the Postgres world has common abbreviation pg, and it seems more logical to call Postgres' c-library libpg, rather than libpq. Why is it called libpq? Is libpg already taken by another tool?

Alexander Myshov
- 2,881
- 2
- 20
- 31
8
votes
4 answers
Variant datatype library for C
Is there a decent open-source C library for storing and manipulating
dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blobs, etc.), while JSON-style arrays and objects as…

Joey Adams
- 41,996
- 18
- 86
- 115
8
votes
3 answers
error while loading shared libraries: libgomp.so.1: , wrong GCC version?
While executing a 3rd party c++ program I get the following error:
error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory
The libgomp.so.1 library is the GNU compiler collection OpenMP runtime…

WillamS
- 2,457
- 6
- 24
- 23
4
votes
4 answers
C or C++ library for encoding and decoding websocket frames
I have my own socket implementation that supports connection from regular tcp client. Now I would like to add websocket support in my server program. In that case I will need to support handshaking and message framing protocols that are supported by…

all_by_grace
- 2,315
- 6
- 37
- 52
4
votes
0 answers
Clear steps for importing a native C library in Kotlin using CLion
I am trying out Kotlin Native and it seems to work.
But the page giving instruction on adding a C library is not clear enough.
For example lets say I wanted to import libcurl and libxml for making a webscraper.
Or say wanted to make GUIs by using…

Kotlinboy
- 3,725
- 4
- 16
- 27
4
votes
1 answer
Can I just include the C libraries when programming an operating system (since they are made in C)
I'm trying to make an operating system for the Raspberry Pi (nothing big, just for fun) and though I could write it all in Assembly, that would be much harder than writing it in C. I'm wondering if (and why not if I can't) I could just include the C…

Dallin Christensen
- 43
- 3
4
votes
2 answers
Runtime typechecking for pointers
I want to know how scanf function is implemented. (Just for fun of course) Number of arguments is variable, so it's certainly implemented by va_list, va_arg macros.
It also throws some warnings, when number of arguments does not match with format…

sorush-r
- 10,490
- 17
- 89
- 173
3
votes
1 answer
Load file to NSData with C
Problem is to load image file to UIImage.
Original file cashed in file system and managed by C-library (question about it).
With objective-C I can do so:
NSData *file = [NSData dataWithContentsOfFile:...];
[UIImage imageWithData:file];
But how it…

Gusev Andrey
- 446
- 5
- 23
3
votes
1 answer
Link Go against a static 32 bit 3rd party library
I am using the flags below
#cgo CFLAGS: -I.
#cgo LDFLAGS: -L. -lcluto
#include
#include "cluto.h"
and when I compile with
go build clutod.go
The compiler fails with error
/usr/bin/ld: pulando…

vuco
- 161
- 2
- 6
2
votes
4 answers
Is there a function in C which checks whether a character is a character or integer, etc?
I have a a homework, and my professor said some of the students figured out that they could check whether the characters they read in are specific ones using a function. He said it was in the string.h library, but I checked and I don't see it. Can…

Andy
- 10,553
- 21
- 75
- 125
2
votes
1 answer
getopt_long() function with custom argc and argv
I am having trouble using getopt_long() function with custom argc and argv.
I receive my arguments in a string instead of the real command line args. Then a new_argc and new_argv was built from this string to be used with getopt_long(). But…

n00pster
- 43
- 6
2
votes
1 answer
API to capture thread's CPU time
I want to measure the CPU time, not elapsed time on a thread. For example, if a thread is waiting or sleeping, it shouldn't count as CPU time because the thread is not in runnable state. So I got the following link to get CPU time. However, it seems…

Kenneth
- 561
- 1
- 5
- 13
2
votes
1 answer
Languages that make system calls directly
I have been learning about system calls in linux and how the GNU C library functions are really just wrappers that end up calling the actual system calls. I have also read that a lot/a few other languages don't actually make their own system calls…
user8396910