Boost logo

Boost Users :

Subject: Re: [Boost-users] Using C++ class with namespace in C
From: Somostetoi Kilato (somostetoikilato_at_[hidden])
Date: 2013-04-24 13:57:16


Hi Richard,

Thank you for your comment. You are totally right, but this was only a
small example what I made after a long learning period :-)
But I would like to know, if I have for example a small C++ library, within
the classes are in a custom name space, how should I write my C wrapper to
use those classes?

Thank you and all the best,
Kilato Somostetoi

2013/4/24 Richard Damon <Richard_at_[hidden]>

> On 4/16/13 5:04 AM, Somostetoi Kilato wrote:
>
> Hi,
>
> maybe it is not the best place to ask but at this moment I have no other
> idea where to go. This question is just a preamble for all the comming,
> BOOST related, questions of mine.
>
> So, I have a C++ class, the Apple, at the moment in the std namespace:
> ...
> My question is, if I want to move my Apple class in a custom namespace,
> garden, how must I modify my C header and code file?
>
> Thank you and all the best,
> Kilato Somostetoi
>
>
> Since your C file only deals with the structure via pointers to void,
> moving the class into a name space will have no effect.
>
> Note, that the functions you are declaring to return/take pointers to
> void, really do return/take pointers to void, and the functions do the
> casting to Apple* inside.
>
> The thing to note is that by definition, a pointer to ANY type/object can
> be converted to a pointer to void and back to its original type and it will
> point to the same object.
>
> --
> Richard Damon
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net