c++ - Static library API question (std::string vs. char*) -
I have not worked with fixed libraries before, but now I need it.
Scenario:
I am writing a console app in Unix, I can easily use std :: string
everywhere because it is easy to do though I recently found out that I would have to support it in Windows and for a third party my code would need an API (I would not just share the source, only DLL).
Keeping this in mind, can I still use std :: string
in my code everywhere, but they can not be used by char *
Can I provide API codes when I do? Will this work?
Yes internally use std :: string
and then the interface Use const char *
on the function (which will be converted to std :: string
s.
Comments
Post a Comment