• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mixing ObjC and C++ STL on same ObjC source file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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) ?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Mixing ObjC and C++ STL on same ObjC source file
      • From: Scott Ribe <email@hidden>
    • Re: Mixing ObjC and C++ STL on same ObjC source file
      • From: Bill Royds <email@hidden>
References: 
 >Mixing ObjC and C++ STL on same ObjC source file (From: Daniel Luis dos Santos <email@hidden>)
 >Re: Mixing ObjC and C++ STL on same ObjC source file (From: email@hidden)
 >Re: Mixing ObjC and C++ STL on same ObjC source file (From: Daniel Luis dos Santos <email@hidden>)

  • Prev by Date: CodeSense doesn't see a global var
  • Next by Date: Re: Mixing ObjC and C++ STL on same ObjC source file
  • Previous by thread: Re: Mixing ObjC and C++ STL on same ObjC source file
  • Next by thread: Re: Mixing ObjC and C++ STL on same ObjC source file
  • Index(es):
    • Date
    • Thread