I am writing a database application in C linux. Currently I work on mysql but later we might migrate to postgres. Therefore my boss has asked my to prepare the application to be able to use either of the databases(mysql or postgres). 

Is there a free api which I can use for this purpose? Or any suggestion on how best I can do this?