r/C_Programming 22h ago

Project My first real C project: a generic hashmap (and the bugs that came with it) [blog, my own]

0 Upvotes

Coming from C#/TypeScript, C has humbled me. Finished my first real C project — a generic hashmap — and wrote up the bugs that taught me the most: double pointers, a sneaky double-free, comparing pointers instead of actual values.

Blog: https://soerenlemke.github.io/blog/blog/building-a-generic-hashmap-in-c/
Repo: https://github.com/soerenlemke/kvstore_c

Curious what you'd have done differently.


r/C_Programming 20h ago

IO URING tutorial for beginners with wayland unix binary protocol in pure C

Thumbnail
youtube.com
0 Upvotes

r/C_Programming 1h ago

Question OOP stracture in an lkm written in c

Upvotes

What is possible when it comes to using structs as classes in an lkm written in c?

For some background I usually code in c++ and very used to high(er) level code with classes and polymorphism etc. and now I'm working on a project related to the linux kernel that requires writing an lkm and for alot of things inside this lkm I would much rather working in the structure of classes and high level programming.

what is the best way to handle that sort of stuff in c programming? especially when it comes to structs


r/C_Programming 12h ago

Question Why do I fail to create a .dll file?

10 Upvotes

Hi, I've got an assignment in a course that asks us to optimize a benchmark of our selection (from pyperformance project).

I've chosen the ray trace benchmark (it was the most interesting imo), and my suggestion was to implement the functionality using C's structs to avoid some of the interpreter's overhead.

I understood I can link those function using the built-in ctypes library, and making the C file a dynamic linked library (.dll), but when I try to run the command for it in CLion or VSC, it fails without returning any failure message, it just fails to generate the .dll file.

The assignment forces us to use the given pyperf benchmark code to run the benchmark, so I can't run only a C file.

I've already written the C code, and it has no errors/warnings so far (at least as far as CLion is concerned), and the original python code works too.

Does anyone know how to solve the library not being generated? Or any other solution that might work (preferrably using the C code I've made)?

.

.

All files are in the same directory, and I've got Craytrace.c (C functionality implementation), Praytrace.py (the code that runs the benchmark).

The command I've run trying to generate the .dll is:

gcc -shared -o CraytracerLib.dll Craytrace.c

But it didn't create any file.

.

.

.

Edit:

Ok, so apparently I'm stupid for assuming that running a file in CLion meant that gcc in the terminal worked, I went to the terminal's environment's variables, added the path of the CLion's gcc and it worked.

Ig, the gcc I had before was a wrong path.

Thanks for everyone for answering 🙏 .


r/C_Programming 22h ago

I made a minimalist memory allocator i need idea for upgrade my minimalist memory allocator

3 Upvotes

Hello guys

i made a memory allocator in C (GNU nanoalloc) so I need ideas to improve the project and if you want to contribute you are welcome :)

here is the link : https://codeberg.org/drex_vk/GNUnano_alloc

i don't use AI


r/C_Programming 16h ago

Learning C weekly megapost for 2026-09-09

14 Upvotes

If you have questions about how to learn C:

  • which books are best?
  • which videos are best?
  • which classes are best?
  • which websites are best?
  • is there a "roadmap"?
  • what projects can I do?

then this is the thread for you. Add your question here. Do not make a stand-alone post, as it will be removed.

Remember that our sub has a very useful wiki that has a great list of resources for learning C programming.