--- "William A. Rowe, Jr." <[EMAIL PROTECTED]>
wrote:

> Can you pinpoint anywhere that we actually reference
> the unmanaged data from managed code (forcing some
> marshalling), or have we successfully kept all of
> the unmanaged data references within the context of
> unmanaged code?

I looked and looked and ... concluded that I am
learning a lot by looking at the optimal way you did
this 'inerfacing' and that problem reported is
probably a compiler bug.

If it were present in earlier runtimes one could be
more lenient and consider it as an 'unpolished
feature', due to pinvoke initially intended for
lanaguages like C#.

I can only notice details like this:

-when there is no dummy apr_table_t compiler generates
pinvokeimpl for apr_table_elts()

-when dummy is present apr_table_elts() is not
generated

-apr_table_setn() is always present as pinvokeimpl,
whether you define dummy or no.

-because apr_table_elts() uses pointer to constant
apr_table_t, compiler is apparently trying to make
some intelligent conclusions about the invocation of
native methods and marshalling if its parameters.   

-exception does not happen in WorkerRequest
constructor where apr_table_elts() is called. So CLR
is not concerned about apr_table_t type at this point,
whether you have its dummy definition or no.

- managed code must make some determination about
types and sizes inside request_rec because it passes
its members to native calls, like in
SetKnownResponseHeader:
....
IL_0065:  ldfld      valuetype
Apache.Native.request_rec*
Apache.Web.WorkerRequest::rr
  IL_006a:  ldc.i4     0xa8
  IL_006f:  add
  IL_0070:  ldind.i4
  IL_0071:  ldloc.3
  IL_0072:  ldloc.0
  IL_0073:  call       void
modopt([mscorlib]System.Runtime.CompilerServices.CallConvStdcall)
apr_table_setn(valuetype Apache.Native.apr_table_t*,
....

I'm not sure this issue is worthy of spending more
time, except maybe as the preparation for solving
possible troubles in the future.

Tony 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to