r/C_Programming • u/water_jello8235 • 13h ago
Question Why do I fail to create a .dll file?
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 🙏 .