1

I'm familiar with C, but haven't written any medium or large application in it. I have a requirement to built an application that can be run as a standalone console application as well as Fast-CGI and Apache module.

I'm thinking of implementing the core functionality as a Static Library and then write a wrapper for console, Fast-CGI and Apache module.

As I'm not a C expert, I was wondering what are my other options. Having the core functionality in a standalone binary and calling it using system calls from the wrappers would work also, however I can't fully write down the pros and cons of each.

Also the software is supposed to run on GNU/Linux machines, so I'm very open to follow the community conventions.

Mahdi
  • 2,003

2 Answers2

1

Why dont you write the core functionality as a dynamic link library in a sdk fashion with clear defined Interface for all the other components so you dont have to link the lib to each need ex. Console application etc.

mitro
  • 111
1

The reason for using a dll is to ship changes to that dll only, the interface wrappers will be unchanged. YMMV if you ship all 3 components simultaneously, so building a static lib and shipping everything each time the code gets an update isn't a bad idea in that case.

You could also consider embedding a webserver (like mongoose or civetweb) in your application so the user can just start it up and get full web functionality without needing apache or fastcgi at all.

gbjbaanb
  • 48,749
  • 7
  • 106
  • 173