marchalling struct on window.

Mansour Al Akeel mansour.alakeel at gmail.com
Tue Mar 16 07:42:28 PDT 2010


Thanks. see my comments please.

On Tue Mar 16,2010 09:00 am, Thiago Macieira wrote:
> Em Segunda-feira 15. Mar?o 2010, ?s 22.28.13, Mansour Al Akeel escreveu:
> > > > In other words I want something similar to publish/subsribe pattern for
> > > > IPC. Performance is a concern to me, as this should be deployed on low
> > > > resource hardware. The daemon should be always running, and the
> > > > services producing events is always running.
> > > > 
> > > > My questions,
> > > > 1- Is dbus right for this ?
> > > 
> > > It's not wrong, though there may be faster alternatives.
> > 
> > What other alternatives are there ? I thought that DBUS uses binary
> > format for exchanging data, which would make it faster.
> > Can you please elaborate? If there's a small; fast alternative then this
> > might be better.
> 
> D-Bus does use binary and is fast. But that doesn't mean it's the fastest 
> possible. For example, a socket will definitely transfer data faster. And 
> shared memory probably even faster.
> 
> But you lose the advantage I mentioned:
Ok, I understand that shared memory is faster, but then I have to deal
with threads to implement events based. 
Let's put it this way, I need an even based IPC that can communicate
with multiple languages. 

> 
> > > The advantage of D-Bus is the availability of bindings to many languages.
> > > 
Don't I have to implement these bindings my self ? I mean if I send a
object data through a signal from C++, I have to translate it to python
object on the other side. Same thing applies between C struct and C#.

> > > > 2- If yes, where can I find basic example about marchalling c struct's
> > > > 
> > > >     and unmarchalling them to C# ?
> > > 
> > > I'll leave this to the people who have done work in C#.
> > 
> > What about a simple example for C stuct ? Do you know any ? It will be
> > a lot of help, if there's a small skelton example, to modify and build
> > on it.
> 
> Again, it depends on the binding.
> 
> I could tell you how to do it with the reference library implementation, but 
> that library is not designed for end-application use. It's designed for 
> binding writing.

Ok, it's obivious that I have misunderstanding about the binding. Like I
said, converting a group of premitive data (C++ object, C struct), into
a format for the wire. The mapping between these data is what you mean
by binding. 
Let's say we have a C struct taken form wikipedia:

struct account {
    int account_number;
    char *first_name;
    char *last_name;
    float balance;
};


How would one convert this to be consumed by dbus, and how to send it as
a signal for interested components ? I was not able to
find a simple example like this one. I will look into converting it back
to C# on the other side.


> 
> So, pick a binding.
> 
> > > > 4- I am working on windows XP with dbus 1.2.4.1, did anyone experience
> > > > 
> > > >     problems with this ?
> > > 
> > > I thought you said you were on low-resource hardware and that performance
> > > was a concern. So why are you using Windows XP and and old version of
> > > D-Bus?
> > 
> > True, I am working on windows XP, since this is the platform installed
> > already on the equipement, we are talking around 1.2 GHz and 512 MB.
> > more or less like one of these mini laptops with Atom processor. And the
> > reason I am using an older version of DBUS is because this is all I was
> > able to find for windows compiled under MinGW. I think my requirements
> > are very basic, and should be covered by an older version.
> 
> That doesn't seem like resource-constrained environments to me. 512 MB is more 
> memory than any smartphone out there, even the highest-end ones, except for 
> the Google NexusOne (which has 512MB).
> 
> If you had 64 MB of RAM on an ARM7 processor, that would be resource-
> constrained.
> 
> -- 
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>   Senior Product Manager - Nokia, Qt Development Frameworks
>       PGP/GPG: 0x6EF45358; fingerprint:
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus



More information about the dbus mailing list