Who doesn’t love a good API? SmartFile sure does! That’s one of the reasons we created the SmartFile API with 38 endpoints for our developer product!

We learned many things while created the SmartFIle for Developer API. Here are a few things to keep in mind when building a native shared library:

  • Choose a programming language that it does not pull in the whole runtime that takes up CPU and memory.
  • Avoid global state if you can. Use “context objects” instead.
  • Do not define common types in public headers.
  • Headers should be light on “includes”. Consider adding a way to disable all includes through a define.
  • Do not expose symbols you do not want exposed in your namespace.
  • Create a macro, like YL_API , that prefixes each symbol you want to expose.
  • Try to build a stable ABI.
  • Do not go overboard with structs.
  • Allow customized memory allocators. If you can’t do it per “context” object, at least do it per library!
  • Don’t force users to use your favorite build tool.

Hopefully this list will help you build your own native library. In the meantime, feel free to get your own SmartFile API key! Acccessing it is easy once you’ve signed up for a free SmartFile for Developers account. As an added bonus, the first three thousand users to signup receive 100GB of space as a thank you. Other features of SmartFile for Developers include five different SDKs, Live Documentation, and OAuth.

Image Credit: Flickr, the_tahoe_guy

Related Posts

Related Topics & Tags: API / Platform

About Leah Beatty

I am the Communications Manager at SmartFile. What I lack in technical programming knowledge I make up in gumption (or so I've been told). I'm a total geek for social media and marketing with a background in SEO and content. I also have one of the most extensive .gif collections this side of the Mississippi.

1 thought on “10 Tips for Building a Native Shared Library”

  1. I also recomend creating your API around a standard such as SOAP or REST. We use a REST API at SmartFile. So, naturally I’m partial to REST.

Leave a Reply

Your email address will not be published. Required fields are marked *