From: Leif M. <lei...@gm...> - 2012-03-26 12:23:16
|
2012/3/26 Leif Middelschulte <lei...@gm...>: > 2012/3/26 Swati Sharma <ita...@gm...>: >> Hello, >> > Hi Swati, >> Basic understanding of how Objective C maps the C++ constructs to the >> low-level code and target language >> >> 1st scenario(wrapper 1):- >> The current scenario of C++ mapping into target language is that the >> wrapped process is divided into two parts . >> 1.One contains C functions(Glue code,ProxyCode) >> 2.Proxy implementations make call to these functions. >> I think >> Benefit:- >> Generated Objective C class have same name as input class. There are more benefits (maintainability, etc.) read below >> >> Drawbacks: >> Two layers of code. >> Two calls instead of one call. >> Less performance >> >> 2nd Scenario(Wrapper 2):- >> The same can be done in one file i.e.creating a single layer of code between >> source and proxy. >> Benefits:- >> One layer of code >> High performance(1 call instead of two). Only one of those two calls is expensive and that's the call of the Obj-C glue function from the rest of your Obj-C code. The inside call of C function that calls C function is almost for free. Maybe read http://www.mulle-kybernetik.com/artikel/Optimization/ to get an idea of call costs in Obj-C/C :-) >> >> Drawback: >> Source and proxy class cannot have same name. >> >> I have attached the files of both the approaches.Both of them has some >> drawbacks and benefits.But,I think second scenario can be more >> benefical(correct me if i am wrong) . Suggest me what was the major benefit >> in accepting the first approach because java and Csharp is also using Ist >> approach. > I think one of the reasons the first approach is used is, because it's > more generic. So optimizations on the wrapper code would have to be > reimplemented for every target language that uses your second approach > :-( > Also, you could reuse the generated wrapper code for other target languages. > Maybe it would make sense to split swig into two tools: > - One for generating wrappers > - One for generating target lang. glue > They are - afair - independent. >> >> >> Regards, >> Swati >> ------------------------------------------------------------------------------ >> This SF email is sponsosred by: >> Try Windows Azure free for 90 days Click Here >> http://p.sf.net/sfu/sfd2d-msazure >> _______________________________________________ >> Swig-devel mailing list >> Swi...@li... >> https://lists.sourceforge.net/lists/listinfo/swig-devel >> > > > > -- > Leif -- Leif |