some problems of when compiling IDL with dice tools
Ronald Aigner
ra3 at os.inf.tu-dresden.de
Wed Jan 17 12:58:30 CET 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
CC'd to l4-hackers, so the most probable solution is in the archives :)
chenggh wrote on 17.01.2007 12:04 this:
> On Wednesday 17 January 2007 17:04, you wrote:
>> chenggh wrote on 17.01.2007 04:52 this:
>>> Hi:
>>> In the idl file i defined an interface including a function declaration
>>> like this:
>>> int foo([in] arg1, [in] void *( * start_routine)(void *), [in] arg2);
>>>
>>> My aim is to define a method which includes a function pointer I define
>>> the function name and function parameters by myself. But when I compile
>>> there is error.
>> Naturally.
>>
>>> I checked out the dice manual there is nothing about how to deal with
>>> function pointer in idl file. Is this style supported by dice IDL ? If
>>> it supports how could I do?
>> No, don't do it!
>>
>> Dice is an IDL compiler. IDL stands for Interface Definition Language.
>> And IDL is *NOT* the C programming language. Even though IDL looks
>> similar to C it is not C. So using function pointers as arguments in an
>> interface definition won't work.
>
> If I want to define a method including a function as a parameter in IDL file
> how can I do?
You will have to find another way of expressing a call-back function,
e.g., using addresses which you convert into a function pointer wherever
you want to invoke the function.
You could write something like:
int foo([in] arg1, [in] unsigned long * addr_func, [in] arg2);
(unsigned long* is used here as the type describing a memory location)
and then in the component function:
/* I did not test this. Maybe it compiles and works, maybe it doesn't. */
foo_component(arg1, unsigned long * addr_func, arg2) {
void *(*start_routine)(void*) = addr_func;
...
start_routine(...);
...
}
However, you usually use IDL to describe an interface for a service that
runs in a *different* address space. Sending a pointer to a function to
that server is useless, because it has no access to that function
located in the client's address space.
Then again, if the function is located in a shared memory region you
could do the above, but would have to "translate" the address from the
client's address space location to the server's address space location.
Or client and server are located in the same address space. Then you
could use the method described above.
Greetings, Ron.
- --
Mit freundlichen Gruessen / with regards
ra3 @ inf.tu-dresden.de
http://os.inf.tu-dresden.de/~ra3/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFFrg9m2sAx3Dtx9+YRApzmAJ92VK5ke3N1wfsLD7Aktp8cVhiR/QCggnS5
DU9EjVEN9u4A+bF9G6b7fSs=
=9Noj
-----END PGP SIGNATURE-----
More information about the l4-hackers
mailing list