'python package equivalent in C

I'm kind of a beginner in c, and I would like to know if there's a way of making a package like in python, for example:

.
├── main.py
└── pkg
    ├── file1.py
    ├── file2.py
    └── __init__.py

how would that look in c?

I'd imagine something like:

.
├── main.c
└── pkg
    ├── a.c
    ├── a.h
    ├── b.c
    └── b.h

is it the way? if so how would that work? how would I use the stuff inside it?



Solution 1:[1]

There is nothing like this exact thing in C, it does not care about packages.

When you want to distribute a "package" you can build it as library, delivering the header files and precompiled libraries (static or dynamic, per OS and architecture, sometimes per compiler)

If you want to organize a big project into packages, just go ahead like your layout - your tools won't really care. You'd include headers of such "packages" by relative path from where you use it. Compilation depends on your toolchain, but generally you have one big project with all the sources.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 LittleFox