Calling a function in a shared library

Is it possible to include a C shared library and make calls to it in Defold?

No (and yes). We are working on an extension system which exposes functionality to create your own shared libraries written in C. Forum user @RG1 has experimented with an alternate non-cross-platform approach: Lua Brigde - Custom Leaderboard?

Note that you can also use Lua modules to share code between projects, but depending on use-case the performance might not be good enough. Did you have a specific use-case in mind?

My use case is that I already have the game logic in C for a turn based game, so I wanted to wrap that in a library instead of rewriting it. It looks like that like kind of does what I want, but I don’t understand why each function is called exec and is in a separate library?

The functions don’t have to be named exec. package.loadlib(libname, func_name) specifies that it “Dynamically links the host program with the C library libname. Inside this library, looks for a function funcname and returns this function as a C function.”

https://www.lua.org/manual/5.1/manual.html#pdf-package.loadlib