I remeber doing similar a few years ago in C++.
I remember having to use some pre-processor directives dclimport and dclexport, but not 100% (been a long time).
The place I looked was a gaming development website (those guys REALLY know their stuff about C++).
Anyway, the URL is:
Hope that points you in right direction