Re: [Mono-list] Embedded API: MonoObject equality

2014-03-21 Thread jonat...@mugginsoft.com
On 20 Mar 2014, at 22:56, Jonathan Lima wrote: > Thats why you can't save references to managed objects across function calls. > > Jonathan > The implementation of mono_object_hash is quite detailed. However it states: Calculate a hash code for @obj that is constant while @obj is alive. So w

Re: [Mono-list] Embedded API: MonoObject equality

2014-03-20 Thread jonat...@mugginsoft.com
On 20 Mar 2014, at 22:43, Jonathan Lima wrote: > AFAIK MonoObject is the pointer to the object in the heap, so you just have > to compare the pointers. > > Jonathan > I think that if the MonoObject instance isn’t pinned then there is no guarantee that successive unmanaged pointers to a manag

[Mono-list] Embedded API: MonoObject equality

2014-03-20 Thread jonat...@mugginsoft.com
What is the bet way to determine if successive MonoObject * pointers refer to the same managed object? Currently I use mono_object_hash(monoObject). Is that the best approach? My unmanaged code triggers and receives events. I need to be able to identify if the MonoObject that triggers the event

Re: [Mono-list] Mono Embedding C-API : Get a MonoClass* without knowing the namespace.

2014-03-18 Thread jonat...@mugginsoft.com
On 7 Mar 2014, at 21:21, candl wrote: > > There's the reflection API available from C code which could potentially > achieve what I want, but I have no idea how to use it, though :(. Would > appreciate any help. Thanks. > Rather that wrestling with the embedded API on this it might be better

[Mono-list] Embedded API: identifier encoding.

2014-03-03 Thread jonat...@mugginsoft.com
In my ObjC - Mono bridge I do something like: MonoObject *monoObject = [self getMonoProperty:"FloatNullable”]; The question is what is the precise encoding required of the property identifier? A C# identifier is defined here : http://msdn.microsoft.com/en-us/library/aa664670.aspx The rules for

Re: [Mono-list] Embedded API. Numeric Boxing and GC

2014-02-26 Thread jonat...@mugginsoft.com
On 26 Feb 2014, at 16:15, Rodrigo Kumpera wrote: > This code is wrong, it will fail when the object is moved since the gchandle > is not pinning the target. > > Avoid pinning as much as possible since it does hurt performance a lot. > > The solution is to remove the monoObject field and use >

Re: [Mono-list] Embedded API. Numeric Boxing and GC

2014-02-25 Thread jonat...@mugginsoft.com
On 25 Feb 2014, at 12:18, Robert Jordan wrote: > On 25.02.2014 11:20, jonat...@mugginsoft.com wrote: >> >> >> Is the above correct? > > Not quite. Look at this line: > > self.monoObject = DB_BOX_INT64(value); > > There is a chance that the Mo

[Mono-list] Embedded API. Numeric Boxing and GC

2014-02-25 Thread jonat...@mugginsoft.com
I box my numeric primitives using a macro: #define DB_BOX_INT64( x ) ( mono_value_box(mono_domain_get(), mono_get_int64_class(), &x) ) And use it like so: 1. - (void)box { MonoObject *monoObject = DB_BOX_INT64(value); } I save the MonoObject * into a local variable. The collector will see th

[Mono-list] PDF generation

2014-01-10 Thread jonat...@mugginsoft.com
What PDF manipulation libraries are currently used by the Mono community? I have turned up: 1. itextsharp 2. pdfjet The popular pdfsharp is, it would seem, .NET only. Thanks Jonathan ___ Mono-list maillist - Mono-list@lists.ximian.com h

Re: [Mono-list] Embedded API: Method signature for ObjectSet.AddObject

2013-11-19 Thread jonat...@mugginsoft.com
On 18 Nov 2013, at 23:17, jonat...@mugginsoft.com wrote: > I cannot get the embedded method signature for the following method quite > right: > > ObjectSet.AddObject Method > public void AddObject(TEntity entity) > http://msdn.microsoft.com/en-us/library/dd487277(v=vs.11

[Mono-list] Embedded API: Method signature for ObjectSet.AddObject

2013-11-18 Thread jonat...@mugginsoft.com
I cannot get the embedded method signature for the following method quite right: ObjectSet.AddObject Method public void AddObject(TEntity entity) http://msdn.microsoft.com/en-us/library/dd487277(v=vs.110).aspx All my efforts so far, such as below, fail to resolve the method (in Obj-C): - (void)a

[Mono-list] OS X framework queries

2013-11-18 Thread jonat...@mugginsoft.com
A few queries regarding the Mono OS X framework: 1. The Mono 3.2.4 Mono.framework/Mono soft link still defaults to libmonoboehm-2.0.1.dylib rather than libmonosgen-2.0.1.dylib. Is this just an oversight? 2. Does the Mono repo contain a script that packages the result of a Mono build into the d

Re: [Mono-list] crash in mono_jit_cleanup

2013-11-18 Thread jonat...@mugginsoft.com
On 17 Nov 2013, at 22:05, Robert Jordan wrote: > On 16.11.2013 17:26, jonat...@mugginsoft.com wrote: >> My work around is to not call mono_jit_cleanup() at all. >> >> I terminate Mono when I terminate my app so I presume that nothing untoward >> can occur. >

Re: [Mono-list] Embedded API: create System.Nullable

2013-10-29 Thread jonat...@mugginsoft.com
On 24 Oct 2013, at 10:31, Robert Jordan wrote: > Jonathan, > > On 23.10.2013 17:37, jonat...@mugginsoft.com wrote: >> What is the recommended way to create an instance of a nullable type, such >> as System.Nullable? >> >> I would prefer a method that used t

[Mono-list] Embedded API: create System.Nullable

2013-10-23 Thread jonat...@mugginsoft.com
What is the recommended way to create an instance of a nullable type, such as System.Nullable? I would prefer a method that used the embedded API as opposed to a C# helper method. Jonathan ___ Mono-list maillist - Mono-list@lists.ximian.co

Re: [Mono-list] [Mono-dev] Embedded API: mono_array_element_size issue

2013-10-02 Thread jonat...@mugginsoft.com
Robert On 2 Oct 2013, at 14:06, Robert Jordan wrote > Jonathan, > > On 02.10.2013 12:21, jonat...@mugginsoft.com wrote: >> The following raises so I presume that I have used it incorrectly: >> >> MonoClass *arrayClass = mono_get_byte_class();

Re: [Mono-list] Embedded API: static constructor calling

2013-10-01 Thread jonat...@mugginsoft.com
On 1 Oct 2013, at 15:35, Robert Jordan wrote: > On 01.10.2013 15:16, jonat...@mugginsoft.com wrote: >> >> On 1 Oct 2013, at 14:01, Robert Jordan wrote: >> >>> mono_field_get_value_object is not mono_field_STATIC_get! >>> You are looking at the wrong fu

Re: [Mono-list] Embedded API: static constructor calling

2013-10-01 Thread jonat...@mugginsoft.com
On 1 Oct 2013, at 14:01, Robert Jordan wrote: > mono_field_get_value_object is not mono_field_STATIC_get! > You are looking at the wrong function. > Sorry. I was trying to imply that, as in mono_field_get_value_object, that mono_field_static_get_value should do its own vtable setup. This look

Re: [Mono-list] Embedded API: static constructor calling

2013-10-01 Thread jonat...@mugginsoft.com
On 1 Oct 2013, at 13:03, Robert Jordan wrote: > On 01.10.2013 11:37, jonat...@mugginsoft.com wrote: >> Is it the case that calling a static field via the embedded API does not >> cause the static constructor to be run? >> This seems to be the behaviour I am observing.

[Mono-list] Embedded API: static constructor calling

2013-10-01 Thread jonat...@mugginsoft.com
Is it the case that calling a static field via the embedded API does not cause the static constructor to be run? This seems to be the behaviour I am observing. In the example below setting the static MetaDataXXX fields (before any other static access) does not cause the static constructor to be

[Mono-list] [ANN] .NET/MONO -> ObjC code generation with Dubrovnik

2013-09-24 Thread jonat...@mugginsoft.com
see https://github.com/ThesaurusSoftware/Dubrovnik Dubrovnik is an OS X framework and set of tools to assist with interfacing Obj-C to .NET/Mono. The framework provides Obj-C access to the embedded Mono API and the code generator reflects on managed assemblies to produce Obj-C source. This large

[Mono-list] OS X 64bit support

2013-09-20 Thread jonat...@mugginsoft.com
Now that the iPhone sports 64 bits will we see the standard OS X Mono framework download supporting 64 bits anytime soon? This does seem to have been on the cards for a while. Jonathan ___ Mono-list maillist - Mono-list@lists.ximian.com http

[Mono-list] Embedded API method signatures

2013-09-05 Thread jonat...@mugginsoft.com
In Obj-C -> embedded API I invoke a method like so: MonoObject *monoObject = [self invokeMonoMethod:"Sum(long[])" withNumArgs:1, [p1 monoValue]]; The following however fails to find the specified method: MonoObject *monoObject = [self invokeMonoMethod:"Sum(System.Int64[])" withNumArgs:1, [p1 mo

Re: [Mono-list] Embedded API: calling explicit operators

2013-09-05 Thread jonat...@mugginsoft.com
On 5 Sep 2013, at 00:01, Robert Jordan wrote: > > Assuming that you're using mono_method_desc_search_in_class () for > method look-ups, there is actually no way to specify the return > type. You may want to enumerate the methods yourself using > mono_class_get_methods (). > mono_method_desc_sear

[Mono-list] Embedded API: calling explicit operators

2013-08-31 Thread jonat...@mugginsoft.com
How is an explicit operator called using the embedded api? For example mscorlib contains a number of explicit operators for NSDecimal: http://msdn.microsoft.com/en-us/library/system.decimal.op_explicit.aspx Reflection returns the operators as methods which I naively attempt to call like so in Ob

Re: [Mono-list] Troubling passing DateTime via embedded API

2013-07-26 Thread jonat...@mugginsoft.com
On 26 Jul 2013, at 14:24, jonat...@mugginsoft.com wrote: > > Will try and figure out what is going on with the tick count. > The tick count looks okay on the C side as far as I can see. > > So perhaps the invocation code is at fault here: My comprehension was at fault. Date

Re: [Mono-list] Troubling passing DateTime via embedded API

2013-07-26 Thread jonat...@mugginsoft.com
On 26 Jul 2013, at 13:48, Robert Jordan wrote: > On 26.07.2013 14:09, jonat...@mugginsoft.com wrote: >>// validate the Mono representatiom >>int64_t ticks = DB_UNBOX_INT64(DBMonoObjectGetProperty(monoDateTime, >> "Ticks")); >>MonoStrin

Re: [Mono-list] Troubling passing DateTime via embedded API

2013-07-26 Thread jonat...@mugginsoft.com
On 25 Jul 2013, at 18:40, Aaron Oneal wrote: > Can you share a code snippet? Are you using mono_object_to_string to retrieve > the string value for display? > Perhaps the code below will help illustrate the point. In C the tick count looks okay by my reckoning but the string representation is

[Mono-list] Troubling passing DateTime via embedded API

2013-07-25 Thread jonat...@mugginsoft.com
Hi I am trying to get and set a System.DateTime property via the embedded API. I can retrieve a default DateTime from my cs model via the embedded API however I am having trouble with the setter. I create a System.Data instance using the runtime API by calling the ticks constructor DateTime(lon

Re: [Mono-list] Embedded API: Method signature not found with generic parameter

2013-07-14 Thread jonat...@mugginsoft.com
On 12 Jul 2013, at 21:48, jonat...@mugginsoft.com wrote: > Can I obtain the generic template type from my ObjectSet MonoObject pointer > rather than having to obtain it from a const char*. > I am trying to write a "generic" routine for calling generic methods. > Perhaps an

Re: [Mono-list] Embedded API: Method signature not found with generic parameter

2013-07-12 Thread jonat...@mugginsoft.com
Hi > On 12.07.2013 22:25, Robert Jordan wrote: >> To me, it looks like you want to inflate & invoke to ToList >> on ObjectSet which doesn't sound quite right to me. > > I'm rephrasing this :) > > It looks like you're inflating ToList with ObjectSet > instead of Data.Employee. You're supposed to

Re: [Mono-list] Embedded API: Method signature not found with generic parameter

2013-07-12 Thread jonat...@mugginsoft.com
> You have to unbox the result of mono_runtime_invoke because it > returns the IntPtr boxed in a MonoObject*. > > Something like that: > > MonoObject* obj = mono_runtime_invoke (...) > MonoMethod* genericMethod = *(MonoMethod**) mono_object_unbox (obj); > The above makes sense but it aborts wit

Re: [Mono-list] Embedded API: Method signature not found with generic parameter

2013-07-12 Thread jonat...@mugginsoft.com
> You must "inflate" the generic method upon invocation. > IIRC, there is no function in the embedded API which does this. There is mono_class_inflate_generic_method() but this requires a MonoGenericContext. I am attempting to call the generic method ObjectSet.ToList(). The code below employs in