Re: Mixing ObjC and C++ STL on same ObjC source file
Re: Mixing ObjC and C++ STL on same ObjC source file
- Subject: Re: Mixing ObjC and C++ STL on same ObjC source file
- From: Daniel Luis dos Santos <email@hidden>
- Date: Sat, 13 Sep 2008 12:45:32 +0100
On Sep 12, 2008, at 11:21 AM, Daniel Luis dos Santos wrote:
The problem was that in CVDisplayPipeline.h I was declaring the map
as a return type of a method, but without specifying the template
types (caused by my relative ignorance of C++).
Now I have another problem, which I wonder if you could help :
On one project I have a target that builds a shared library target
in C++ exclusively. On another target I have a objC app that uses
the first as a project dependency.
When I call a method on the library with a pointer to a STL map
(std::map<std::string, std::string>) as an argument, the linker
complains it can't find it. I made a test method on the lib that
takes only a std::string and it works. Passing a std::map<int, int>
fails with the same error. Other methods in the lib that don't use
STL are found by the linker.
Don't know what is happening, or if there is any limitation because
of STL.
I looked up the documentation from apple on using the C++ runtime, and
learned that in practice it is not to be assumed that two C++ runtime
versions even on the same OS maintain compatibility. Then one should
not put STL on library boundaries because of portability between
libstdc++ implementations.
That said, STL can be used only within a library's own code. Then when
coding a shared library one must implement all kinds of data
structures that can be used at the boundary. Isn't that like
reinventing the wheel ?
Having to implement those data structures is a lot of work (at least
for who's beginning to write C code). Having to do a map
implementation or a linked list is almost like starting from scratch.
Is there any implementation of those standardized in the C world (that
is only C and portable) ?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden