Re: [Mono-dev] starting process in Linux environment
Okay, in that case can you post the stack trace and error message? Thanks, Spink. On Feb 21, 2012 10:28 PM, ? ? bmwfreak...@hotmail.com wrote: hi yes true, i forgot that, but i dont think thats the problem. because without that processstartinfo, streamwriter writes it in the homefolder and gives no error. -- Date: Tue, 21 Feb 2012 14:01:47 + Subject: Re: [Mono-dev] starting process in Linux environment From: tsp...@gmail.com To: bmwfreak...@hotmail.com Are you on Linux or Windows? You're running a Linux program, but have a Windows path in your StreamWriter! There's your problem! Spink. On Feb 21, 2012 1:59 PM, pattex007 bmwfreak...@hotmail.com wrote: thank you for your answer á Process procNetAdapters = new Process(); á á á á á á á áProcessStartInfo startInfo = new ProcessStartInfo(/bin/bash); á á á á á á á ástartInfo.Arguments = -c 'ifconfig | grep \\'inet addr:\\''; á á á á á á á ástartInfo.UseShellExecute = false; á á á á á á á ástartInfo.RedirectStandardOutput = true; á á á á á á á ástartInfo.CreateNoWindow = true; á á á á á á á áprocNetAdapters.StartInfo = startInfo; á á á á á á á áprocNetAdapters.Start(); á á á á á á á áfile = new System.IO.StreamWriter(@c:\ + setLogName + .log, true); á á á á á áusing (StreamReader r = procNetAdapters.StandardOutput) á á á á á á á á{ á á á á á á á á á ástring line; á á á á á á á á á // string removedLine; á á á á á á á á á áwhile ((line = r.ReadLine()) != null) á á á á á á á á á á{ á á á á á á á á á á á áfile.WriteLine(line); á á á á á á á á á á} á á á á á á á á} á á á á á áfile.Close(); á á á á á áprocNetAdapters.Close(); if i run this i get an error with stacktrace -- View this message in context: http://mono.1490590.n4.nabble.com/starting-process-in-Linux-environment-tp4406870p4407088.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Network file path URI
On Dec 15, 2011 4:37 PM, Mike Murdock mmurd...@allmeds.com wrote: I am trying to point to a network file share and don’t know how to format the URI I have tried \\server\share\path\test.jpg and it gives me a “Unreconized escape sequence’ I tried switching the “/” put it does not load the file. Any Ideas? Hi, you need to double up the backslashes, or put an @ sign at the start of the string in order to tell the parser not to process escape codes: server\\share\\path\\test.jpg Or @\\server\share\path\test.jpg Tom. Michael Murdock Software Engineer ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] System.Data.OracleClient.OracleParameter.SetOracleType() bug?
On 29 September 2011 14:53, iamwind iamwin...@hotmail.com wrote: snip Would you modify the code like following? Type valType = typeof(System.String); if(value != null) { valType = value.GetType (); } thanks! Well, without any other context, I'd do this: /// if (value == null) valType = typeof(System.DBNull); else valType = value.GetType(); /// Which means for a 'null value', the 'value type' would be DBNull. Hope this helps, -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Need PutVar method on Mono.CSharp.Evaluator
On 15 August 2011 16:36, Charles Rich r...@wpi.edu wrote: Hi Mark, Thanks for the reply, but that just pushes the problem one level back, i.e., how is 'whatever' set to the result of the evaluation? The point is that I need to be able to pass the result of the evaluation around *outside* the evaluator and then feed it back in. -CR On Mon, Aug 15, 2011 at 11:27 AM, Marek Safar marek.sa...@gmail.com wrote: Hello, Hi, I am new to Mono, but becoming a big fan quickly (more detail below regarding what I am doing with it). To get right to the point, however, I would appreciate advice on how to *programmatically* set the value of a variable that can be seen inside the Evaluator, e.g., var temp = Evaluator.Evaluate(...); Evaluator.PutVar(x, temp); // so such method exists! Evaluator.Run(... x ...); You can simply run C# statement which will do the assignment. Trivial example can look like this Evaluator.Run(x = whatever); Marek -- Dr. Charles Rich, Professor of Computer Science Interactive Media and Game Development Worcester Polytechnic Institute, Fuller Laboratories B25b 100 Institute Road, Worcester, MA 01609-2280 Email: r...@wpi.edu Phone: 508-831-5945 Fax: 508-831-5776 Home: http://www.cs.wpi.edu/~rich ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list Hi Charles, I think what Marek is trying to say is, instead of consuming the output of the first evaluate method, perform an assignment to a variable, then reuse that variable in subsequent calls: var temp = Evaluator.Evaluate(...); Evaluator.PutVar(x, temp); // so such method exists! Evaluator.Run(... x ...); Evaluator.Run(var x = ...); Evaluator.Run(... x ...); If you need to get 'x' out, then you can use the GetVars() method as you have previously found. -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Need PutVar method on Mono.CSharp.Evaluator
Hi slide, On 15 August 2011 16:49, Slide slide.o@gmail.com wrote: I think Charles is wondering how he gets his stuff inside the evaluator in the first place. For instance, if he has OUTSIDE the evaluator, some instance of an object, how does he get that object into the evaluator so the evaluator can interact with it. From my experience, there is access to the scope in which the evaluator is created in, I added objects to a context object and then grab them out inside the repl code as needed, but is there a better way to do it? Thanks, slide Well, his initial sample could be solved the way I suggested. However, a quick Google turned up the following thread, which may be of some use: http://stackoverflow.com/questions/3788096/injecting-a-variable-into-the-mono-csharp-evaluator-runtime-compiling-a-linq-que -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mixed Mode Assemblies
On 10 July 2011 06:28, arkain king...@gmail.com wrote: So it looks like you guys are saying that allowing mono to create mixed-mode assemblies is possible given the following constraints: 1. The .NET metadata must always be found in a PE container. 2. A mixed mode assembly must always be a native format library so as to allow native programs to load them. 3. The PE container for the managed portion of the assembly should be contained as a resource of the native format library in a mixed mode assembly 4. The mixed-mode assembly should also load the necessary mono assemblies when loaded from a native application. With so many of you marking this as an interesting exercise, is there any chance that this to date missing feature will find its way into a near future release? Hi Guys - if you're still watching this thread, So I may have done something brilliant - or something terrible. I don't quite know yet - I need your feedback to see if I'm heading along the right lines. What I've done is to create a tool that creates a shared library with an embedded PE assembly inside. The shared library exports symbols that pertain to methods of the assembly, and when you link against this shared library, in a native application, you can then call those methods, without having to bother with using Mono's embedding API. Essentially, a bunch of method stubs are created that when called ensure the runtime is initialised, the assembly loaded (from inside the shared library) and then locate and call the appropriate method. After the runtime has been loaded, the first few bytes of the method are overwritten with NOPs to ensure the runtime isn't loaded twice. The symbols exposed take the form of 'Namespace_Class_MethodName', which just works for static methods, but to call instance methods, you construct the class with a call to a 'new_Namespace_Class' function, then pass in the object instance as the first member. At the moment, the Makefile is more automated than the code generator, but if this seems like a worthwhile direction to head in, let me know and you can give me some feedback on my (rudimentary) implementation. Anyone interested at all? Or am I barking mad^H^H^Hup the wrong tree? -- Tom. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mixed Mode Assemblies
On 20 July 2011 16:05, Robert Jordan robe...@gmx.net wrote: Hi Tom! Hi Robert! Nice :) Not exactly Mixed Mode Assemblies though, because the really interesting part (calling unmanaged code w/out having to go through p/invoke) remains the same pain. Absolutely - I've been thinking a lot about that direction, and I think you'd probably need to write/extend a compiler to do it properly/efficiently. What I've made is just a wrapper around the Mono embedding API, exposing classes as symbols in a shared object. To properly build a mixed-mode assembly, I guess you'd have to have a compiler that was aware of it - I think. Out of curiosity: How are you handling more than one of those mixed assemblies in the same process? Is there a function inside libmono that can be used to detect an already initialized runtime? An interesting question - because I was just pondering that myself. Answer is, I haven't thought about it yet and so haven't tackled the problem. I am hacking away at it just now, so eventually I'll come across the issue! On the generated stubs: are you using thunks or mono_runtime_invoke? Are you rewriting the signature of the stubs to be HRESULT-like (to be able to catch/detect managed exceptions)? I'm using mono_method_get_unmanaged_thunk, and at the moment if any exception was raised (by use of the exception output parameter in the thunk), it just gets re-thrown in situ, and hence not handled by the calling code. What I've done is make GCC put the stubs into their own linker section that's writable (so as to make it possible to patch the stubs at runtime), and to this end, I'd like to re-write the entire stub on first call, after it's gotten the unmanaged thunk, to directly call the function pointer, thus reducing the overhead of the stub. It's an interesting problem to tackle, because you need to provide this exception to the calling code somehow, but I'm trying to limit the amount of information exposed to the callers, as I wanted it to be as close to native as possible. So,the stubs, at the moment, are just direct copies of the managed method signatures (plus a *this parameter for instance methods). Let me see if I can get the code uploaded somewhere. Oh, and another interesting problem to solve is that of multi-threading, firstly as you need to call mono_thread_attach when using threads and the embedding API, and secondly race conditions between initialising the runtime and calling other functions. It may have to be some kind of terrible lock, or something. Robert -- Tom ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mixed Mode Assemblies
Hi guys, Since it's only 3.5k tarred up, I've attached it to this email - I hope that's not too rude! Let me know what you think! And don't give me a hard time for some of the hacks ;) -- Tom sogen.tar.gz Description: GNU Zip compressed data ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mixed Mode Assemblies
On 20 July 2011 17:02, Tom Spink tsp...@gmail.com wrote: Hi guys, Since it's only 3.5k tarred up, I've attached it to this email - I hope that's not too rude! Let me know what you think! And don't give me a hard time for some of the hacks ;) -- Tom And, I've just stuck it into GitHub, if you want to see it. Also, I've just updated it to do the function stub re-writing I was talking about - using label pointers! http://github.com/tspink/sogen -- Tom ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mixed Mode Assemblies
On 20 July 2011 17:41, Robert Jordan robe...@gmx.net wrote: Hi Tom! Hey! On 20.07.2011 18:02, Tom Spink wrote: Hi guys, Since it's only 3.5k tarred up, I've attached it to this email - I hope that's not too rude! Let me know what you think! And don't give me a hard time for some of the hacks ;) I'm quoting from the TODO: * Automate DLL_NAME to pull it from somewhere. We could store the necessary runtime version and the assembly name in the generated C++ stub, then use mono_jit_init_version for initialization. Brilliant! Just an entry in the string table, and a symbol pointing to it should do. Bit of linker script magic will probably help here. * Rewrite each stub after first call to call the function pointer proper, and hence bypass the NULL test. I'm biased whether this is necessary altogether. Is it a burden for the SO user if we'd require a first call of an provided initialization function? This function could be even called automatically, unless we really want to postpone mono's initialization. Well, I went ahead and did it before I got your reply... Let me know what you think. It's most certainly non-portable, which is a /bad thing/. * Think about multiple loaded assemblies, and the impact that will have on loading the runtime/appdomain twice. Maybe we should propose a mono_jit_is_initialized() for libmono, unless there is already a way to detect this, that we're not aware of. Yes - this is a good idea. I'm also wondering if the support library should actually be linked in as a shared library, in which case it can simply hold a flag about whether or not the JIT has been loaded. Looking at mono_jit_init(), it would be very easy to add a mono_jit_is_initialized() function, by simply setting a flag in mono itself. I think I remember seeing a discussion about multiple invocations of mono_jit_init() somewhere - was there ever a resolution to that? * Think about multi-threading, and how to invoke mono_thread_attach. IIRC, when I wrote the thunk support, I've reused a method wrapper type that already performs mono_thread_attach() on managed/unmanaged boundaries. I even wanted to introduce a new wrapper type to get rid of mono_thread_attach() for performance reasons, but never did it. Interesting! That's quite clever actually - calling attach when actually calling into the runtime via a thunk, from a thread that hasn't been attached. Let me know your thoughts on getting rid of mono_thread_attach(). Robert -- Tom ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mixed Mode Assemblies
On 8 July 2011 18:57, Alex Corrado alexander.corr...@gmail.com wrote: Tom, On Fri, Jul 8, 2011 at 1:40 PM, Tom Spink tsp...@gmail.com wrote: Why do you think that? I've actually pondered this approach for a while, as it could potentially bring a couple of benefits. I am curious to know what benefits you are referring to. The original poster said: Without a doubt, every case where I've wanted/needed to use C++.NET has been to create a mixed mode assembly with the intent of creating a clean, optimized .NET interface for some piece of unmanaged code. If P/Invoke and System.Runtime.InteropServices formed a complete solution for importing native functionality into .NET, then I doubt Microsoft would have bothered allowing for mixed-mode assemblies at all. I tend to agree with this statement. Mixed-mode assemblies, whether in PE or some other format, strike me as hackish and are not portable across platforms. How managed and native code are packaged (same binary or separately) is not really related to the problem of the two interoperating. It would be perfectly possible to create a source-compatible C++/CLI implementation that emits native code in a platform native binary, and managed code in an ECMA CLI native (PE) binary. Best, Alex Corrado Hi Alex, Interestingly enough, I wasn't thinking about mixed-mode assemblies at all! I was just thinking about normal assemblies being packaged in an ELF container, rather than a PE container. (I must have lost track of the conversation) The reason being, on a platform that supported loading ELF binaries, you could get to load the mono runtime by emitting native code in in the appropriate ELF section, for the entry-point. Of course, on Linux you have binfmt_misc - but personally, this has always felt like a hack. And, I completely agree that mixed-mode assemblies are, even by definition, non-portable - for the reasons you've already given. -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Threads sleeping forever
On 5 July 2011 15:31, Darkiwi pitikiwi_...@hotmail.com wrote: In the main thread, the launching of the tests : snip Hi Chris, Do you know which sleep it's getting stuck in? I can see a sleep for 0, and a sleep for 10. Tom. -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Threads sleeping forever
On 5 July 2011 16:11, Darkiwi pitikiwi_...@hotmail.com wrote: Thank you Robert and Tom for your fast answers. When the test is stuck, it's always in the Sleep(10). Hi, Are you doing any UI manipulation in /any thread/ that's not your main UI thread? I can't see any in the sample you provided - but there are a couple of other mystery function calls in there - is there anything that isn't your UI thread that's updating UI objects. If there is, can you provide that part of the code? Tom. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Threads sleeping forever
On 5 July 2011 16:28, Darkiwi pitikiwi_...@hotmail.com wrote: @Tom: Yes, as my test is running, it updates the UI. The events are sent into a fifo which is depiled in the main thread's Application.Idle to avoid invoke problems. If I remember well, I also tried commenting this but it did not solve my problem :-( I will run this test again, just to be sure. Interesting - is it a lot of updates you're doing, via Application.Idle? You might consider reworking your updates to using BeginInvoke and/or Invoke to see if it's a problem with your Application.Idle approach. Of course, if you disable any updating of the UI and you're still in trouble, then it's unlikely that it's a problem with your UI update marshalling code. However, thinking about what you've said - how are you synchronising the UI update queue? You said you're pushing events into a FIFO - how is that FIFO producer synchronised, WRT the Application.Idle consumer? -- Tom ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Suggestions for Visualizers please...
On 14 April 2011 13:07, Abdul Rauf raufb...@gmail.com wrote: On 12 April 2011 12:33, Abdul Rauf raufb...@gmail.com wrote: Hello everyone, I am participating in GSoC 11 and interested in working on Debugger Visualizers. I have put up a proposal here (http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/edil/2002) I have got some feedback and I am looking to extend the proposal. I would like you to please share your opinion. One suggestion is to implement a Task Visualizer to show tasks in the scheduler's task queue and their state. I am new to IDE development so I would be grateful if someone explains this suggestion to me like how this visualizer will work? (would it be working as a standalone application or runs in the same way as my other proposed visualizers) Thanks Rauf Hi, After having some thoughts about visualizers, I have come across two more visualizers which I think would add value to the Mono community. These are LINQ to SQL Visualizer: Sometimes, a small mistake in a query could result in undesirable results and its hard to locate such small mistakes in the console. This visualizer will show LINQ query in a presentable form so a developer can easily see any mistake. Exception Visualizer: This visualizer will display exceptions in a graphical form (e.g., in XML style) easier to see exception details and stack trace. Please share your thoughts. Thanks Rauf ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list Hi Rauf, Are you intending to send these messages to the MonoDevelop mailing list? You're emailing the Mono list, which deals with the runtime, and your GSoC proposal appears to be aimed at MonoDevelop. If you're looking for opinions from the Mono community, I suggest you take a look at the following pages: http://mono-project.com/Community http://mono-project.com/Mailing_Lists -- Tom. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono-devel-list Digest, Vol 72, Issue 10
On 7 April 2011 05:56, Sharp Blade无厚之刃 sharper.than.bla...@gmail.com wrote: Hello! Well,since I have a lot of experience with Antlr on C#,it does not seem to be a good choice to use jay.And the makefile grammar is quiet simple,I wonder if I could write the parser by hand. Sharp Hello! Unfortunately, the Makefile grammar is not as simple as you think, and simple or not, writing parsers by hand is generally discouraged nowadays, for the simple reason of:- why re-invent the wheel? There are tools available for parser (and lexer) generation, which are tried and tested and I think you'll find you'll make more mistakes rolling your own parser, than you'll get if you use a parser generator. Also, writing an LALR, LR(1) or indeed any bottom-up parser by hand is quite challenging - even for the simplest grammars. If you really went down this route, you'd be best off writing a top-down parser, which can exponentially increase in size as a grammar increases. But, I still wouldn't recommend it, as the more you get into the grammar, the more you'll find yourself changing your parser and wishing you'd used a generator. You'll also need to construct a lexer for the Makefile - which is itself a daunting challenge. Particularly because the Makefile syntax is really quite complex (since it's heavily context-based), so you'd have trouble implementing a lexer and parser yourself. Hope this helps, -- Tom. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono-devel-list Digest, Vol 72, Issue 10
2011/4/7 Chris Seaton ch...@chrisseaton.com: Just be aware that not all grammars can express all languages, and so not all parser-generators can parse all languages. GNU Make does not use a parser-generator to parse Makefiles - perhaps there's a good reason. You say that a lexer for Make would be very context-dependent, and most parse-generators don't handle that well at all. Good points! But, there are tools available that make context-sensitive lexing and parsing much easier - flex and bison, for example. Generally, parsing is a pretty simple problem in the first place and I think that parser-generators often introduce more problems than they solve. Why can't you nest block comments in C? Because of a limited lexer-generator. Well - okay... but you can use a better lexer generator. Writing lexers and parsers by hand does have it's merits - for both academic and practical reasons (e.g. at University, I thoroughly enjoyed making a finite-state-machine based lexer, and writing an LALR parsing table by hand), but when tools that are purpose built for solving a complex problem - because in fact parsing /is/ a complex problem - then those tools should be utilised as an aid to reduce the amount of time you have to spend debugging and altering your own implementation. The reason I say that parsing /is/ a complex problem is because parsing isn't just about matching input to a specified grammar, it's also about building a data structure describing what the input is representing, and giving feedback when the input does not conform to syntax. Taking into account this, although it seems that all you're trying to do is recognise input, it's actually quite complicated when you start having to deal with and process this input. Do a quick google for a Make grammar for Antlr or Jay and see if anyone else has managed it. I presume you mention this because there aren't any. Touche, Chris. ;-) Regards, Chris Seaton -- Tom ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] StackOverflow on System.Delegate.Equals
Hi Marcin, I very much agree with you here. Even searching for assignments to prev, doesn't yield anything too suspicious (except for where a local variable overrides the scope of the class-level field!). All assignments *appear* to be clones, which is okay. Can you squeeze out any more debugging information? -- Tom. On 29 March 2011 15:33, krlm kr...@poczta.onet.pl wrote: Hi Tom, Thanks for your reply. I've also just took a look on the MulticastDelegate implementation and on the CombineImpl method but I cannot see how to make that this.prev to be equals to this. Maybe the issue lies in the RemoveImpl method/KMP? I'll try to debug this step by step. Thanks in advance for any advices. Best regards, Marcin -- View this message in context: http://mono.1490590.n4.nabble.com/StackOverflow-on-System-Delegate-Equals-tp3411024p3415001.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Howto Marshal IntPtr to Elf32_Phdr[] ?
Hi, Still I was hoping for a less-hackish method via MarshalAs. Unfortunately, MarshalAs almost helps you out, by giving you a SizeParamIndex property, to indicate to the marshaller which parameter to get size information from when marshalling an LPArray. But - this is only for methods (that have a signature with a parameter indicating the size of the array), not for structures, so it doesn't really help. sounds awfully x86 specific, maybe even x86-32 specific Well, it's just pointer arithmetic - your not actually manipulating memory here, or doing anything clever at all. You're just reading from a certain location. It's up to the API how it presents the memory - in this case, a C-style array, which is compiler specific not platform specific. [MarshalAs(UnmanagedType.LPStr)] Good point on marshalling your string, with LPStr. I was going to mention it - but forgot. On 27 March 2011 22:20, Quandary quandar...@hailmail.net wrote: Hi Tom, Thank you, that works. Still I was hoping for a less-hackish method via MarshalAs. address + j * sizeof(mystruct_t) sounds awfully x86 specific, maybe even x86-32 specific But then again, so is struct Elf32_Phdr the way I did it. As a side-note to other potential users: If I/you apply [MarshalAs(UnmanagedType.LPStr)] to public System.IntPtr dlpi_name; and instead call it public string dlpi_name; then I needn't marshall it in the callback. Kind regards Stefan On 03/27/2011 06:23 PM, Tom Spink wrote: Hi Quandry, You've almost got it - you just need to do a bit of pointer arithmetic. In your for loop, you've got this: /// for (j = 0; j info.dlpi_phnum; j++) Console.WriteLine(\t\t header {0}: address={1}\n, j, 22); /// Not sure what that 22 is... but if you do this: /// for (int j = 0; j info.dlpi_phnum; j++) { var ptr = new IntPtr(info.dlpi_phdr.ToInt64() + (j * Marshal.SizeOf(typeof(Elf32_Phdr; var hdr = (Elf32_Phdr)Marshal.PtrToStructure(ptr, typeof(Elf32_Phdr)); Console.WriteLine(\t\t header {0}: address={1}: offset={2}\n, j, info.dlpi_phdr, hdr.p_offset); } /// Inside your for loop, you've now got the 'hdr' variable, which is the Elf32_Phdr struct of the 'current element' in the array. This works because info.dlpi_phdr is a pointer to the base address of the array - where the array is just a sequential list of Elf32_Phdr structures. So, by taking the base address, then adding on the index into the array (multiplied by the size of the array's element type), you'll get the base address of that particular element. Once you've got this base address, all you have to do is marshal that pointer, to the right structure type. Also, make sure you mark your structures with the following attribute: [StructLayout(LayoutKind.Sequential)] Hope this helps! -- Tom On 27 March 2011 16:43, Quandary quandar...@hailmail.net wrote: Hi everyone, I have a problem with dl_iterate_phdr. (man 3 dl_iterate_phdr) You find the (till now unanswered) question on stackoverflow, I'm not inclined to retype everything here again, so below the link: http://stackoverflow.com/questions/5447282/c-howto-marshal-intptr-to-an-array-of-struct In a nutshell, the problem is the struct dl_phdr_info you see below. It seems I need to Marshal public System.IntPtr dlpi_phdr; to public Elf32_Phdr[] dlpi_phdr; somehow. Or maybe I did translate it to managed code the wrong way. Can anybody have a look at it ? All necessary code/structs to get the sample running you find on the stackoverflow link. Here's the C struct: struct dl_phdr_info { ElfW(Addr) dlpi_addr; /* Base address of object */ const char *dlpi_name; /* (Null-terminated) name of object */ const ElfW(Phdr) *dlpi_phdr; /* Pointer to array of ELF program headers for this object */ ElfW(Half) dlpi_phnum; /* # of items in dlpi_phdr */ }; Here's my C# translation of the above struct: public struct dl_phdr_info { public System.UInt32 dlpi_addr; /* Base address of object */ // TODO: String, MarshalAs Pointer public System.IntPtr dlpi_name; /* (Null-terminated) name of object*/ /* Pointer to array of ELF program headers for this object */ public System.IntPtr dlpi_phdr; // Hackish, cannot read it, but then at least the rest works // This way it throws an exception at runtime. //[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPStruct)] //public Elf32_Phdr[] dlpi_phdr; public System.UInt16 dlpi_phnum; /* # of items in 'dlpi_phdr' */ } ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo
Re: [Mono-dev] Howto Marshal IntPtr to Elf32_Phdr[] ?
Hi, I only mentioned it as a point of interest - I'm afraid it doesn't actually help you here. You would use the MarshalAs attribute on a parameter in a method declaration, that has a C-style array, and has a size parameter. Take a look at the following MSDN example: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.sizeparamindex(v=vs.71).aspx Hope this helps, -- Tom On 28 March 2011 13:01, Quandary quandar...@hailmail.net wrote: So what you're saying is that System.Runtime.InteropServices.UnmanagedType.LPStructArray is inexistant, so there can be no [MarshalAs(UnmanagedType.LPStructArray)] Basically, one could add a property at the end and rename the IntPtr variable ? Or would that shift the offsets ? In which case the next question would be whether there exists a [MarshalAs(UnmanagedType.Ignore)] attribute that I could prefix the property with. Am 28.03.2011 09:29, schrieb Tom Spink: Hi, Still I was hoping for a less-hackish method via MarshalAs. Unfortunately, MarshalAs almost helps you out, by giving you a SizeParamIndex property, to indicate to the marshaller which parameter to get size information from when marshalling an LPArray. But - this is only for methods (that have a signature with a parameter indicating the size of the array), not for structures, so it doesn't really help. sounds awfully x86 specific, maybe even x86-32 specific Well, it's just pointer arithmetic - your not actually manipulating memory here, or doing anything clever at all. You're just reading from a certain location. It's up to the API how it presents the memory - in this case, a C-style array, which is compiler specific not platform specific. [MarshalAs(UnmanagedType.LPStr)] Good point on marshalling your string, with LPStr. I was going to mention it - but forgot. On 27 March 2011 22:20, Quandaryquandar...@hailmail.net wrote: Hi Tom, Thank you, that works. Still I was hoping for a less-hackish method via MarshalAs. address + j * sizeof(mystruct_t) sounds awfully x86 specific, maybe even x86-32 specific But then again, so is struct Elf32_Phdr the way I did it. As a side-note to other potential users: If I/you apply [MarshalAs(UnmanagedType.LPStr)] to public System.IntPtr dlpi_name; and instead call it public string dlpi_name; then I needn't marshall it in the callback. Kind regards Stefan On 03/27/2011 06:23 PM, Tom Spink wrote: Hi Quandry, You've almost got it - you just need to do a bit of pointer arithmetic. In your for loop, you've got this: /// for (j = 0; j info.dlpi_phnum; j++) Console.WriteLine(\t\t header {0}: address={1}\n, j, 22); /// Not sure what that 22 is... but if you do this: /// for (int j = 0; j info.dlpi_phnum; j++) { var ptr = new IntPtr(info.dlpi_phdr.ToInt64() + (j * Marshal.SizeOf(typeof(Elf32_Phdr; var hdr = (Elf32_Phdr)Marshal.PtrToStructure(ptr, typeof(Elf32_Phdr)); Console.WriteLine(\t\t header {0}: address={1}: offset={2}\n, j, info.dlpi_phdr, hdr.p_offset); } /// Inside your for loop, you've now got the 'hdr' variable, which is the Elf32_Phdr struct of the 'current element' in the array. This works because info.dlpi_phdr is a pointer to the base address of the array - where the array is just a sequential list of Elf32_Phdr structures. So, by taking the base address, then adding on the index into the array (multiplied by the size of the array's element type), you'll get the base address of that particular element. Once you've got this base address, all you have to do is marshal that pointer, to the right structure type. Also, make sure you mark your structures with the following attribute: [StructLayout(LayoutKind.Sequential)] Hope this helps! -- Tom On 27 March 2011 16:43, Quandaryquandar...@hailmail.net wrote: Hi everyone, I have a problem with dl_iterate_phdr. (man 3 dl_iterate_phdr) You find the (till now unanswered) question on stackoverflow, I'm not inclined to retype everything here again, so below the link: http://stackoverflow.com/questions/5447282/c-howto-marshal-intptr-to-an-array-of-struct In a nutshell, the problem is the struct dl_phdr_info you see below. It seems I need to Marshal public System.IntPtr dlpi_phdr; to public Elf32_Phdr[] dlpi_phdr; somehow. Or maybe I did translate it to managed code the wrong way. Can anybody have a look at it ? All necessary code/structs to get the sample running you find on the stackoverflow link. Here's the C struct: struct dl_phdr_info { ElfW(Addr) dlpi_addr; /* Base address of object */ const char *dlpi_name; /* (Null-terminated) name of object */ const ElfW(Phdr) *dlpi_phdr; /* Pointer to array of ELF program headers for this object
Re: [Mono-dev] StackOverflow on System.Delegate.Equals
Hello, After a quick glance over the implementation of MulticastDelegate, it looks like it could be a bug. But I'm not too sure. To me, it looks like the bug is here, line 96: return this.prev.Equals (d.prev); If 'this.prev' is == 'this', then, this would cause an infinite recursion, as the call to equals would just call itself. I think a fix would be to add a call to ReferenceEquals, to see if this.prev == this, then return true - but I'm not too sure. -- Tom On 28 March 2011 09:22, krlm kr...@poczta.onet.pl wrote: Hello, I've found an issue in my ASP.NET application when it's running under heavy load. It throws an exception like that: http://pastebin.com/DRAYVM0F and then the whole application is down, i've to restart apache/mod-mono-server. It's running under mono 2.10.1, apache2 and mod-mono. On IIS/MS.NET i've not found any problems, even on heavier load. Maybe someone has any thoughts/ideas what might causing problem like this? Thanks in advance. Kind regards, Marcin -- View this message in context: http://mono.1490590.n4.nabble.com/StackOverflow-on-System-Delegate-Equals-tp3411024p3411024.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Howto Marshal IntPtr to Elf32_Phdr[] ?
Hi Quandry, You've almost got it - you just need to do a bit of pointer arithmetic. In your for loop, you've got this: /// for (j = 0; j info.dlpi_phnum; j++) Console.WriteLine(\t\t header {0}: address={1}\n, j, 22); /// Not sure what that 22 is... but if you do this: /// for (int j = 0; j info.dlpi_phnum; j++) { var ptr = new IntPtr(info.dlpi_phdr.ToInt64() + (j * Marshal.SizeOf(typeof(Elf32_Phdr; var hdr = (Elf32_Phdr)Marshal.PtrToStructure(ptr, typeof(Elf32_Phdr)); Console.WriteLine(\t\t header {0}: address={1}: offset={2}\n, j, info.dlpi_phdr, hdr.p_offset); } /// Inside your for loop, you've now got the 'hdr' variable, which is the Elf32_Phdr struct of the 'current element' in the array. This works because info.dlpi_phdr is a pointer to the base address of the array - where the array is just a sequential list of Elf32_Phdr structures. So, by taking the base address, then adding on the index into the array (multiplied by the size of the array's element type), you'll get the base address of that particular element. Once you've got this base address, all you have to do is marshal that pointer, to the right structure type. Also, make sure you mark your structures with the following attribute: [StructLayout(LayoutKind.Sequential)] Hope this helps! -- Tom On 27 March 2011 16:43, Quandary quandar...@hailmail.net wrote: Hi everyone, I have a problem with dl_iterate_phdr. (man 3 dl_iterate_phdr) You find the (till now unanswered) question on stackoverflow, I'm not inclined to retype everything here again, so below the link: http://stackoverflow.com/questions/5447282/c-howto-marshal-intptr-to-an-array-of-struct In a nutshell, the problem is the struct dl_phdr_info you see below. It seems I need to Marshal public System.IntPtr dlpi_phdr; to public Elf32_Phdr[] dlpi_phdr; somehow. Or maybe I did translate it to managed code the wrong way. Can anybody have a look at it ? All necessary code/structs to get the sample running you find on the stackoverflow link. Here's the C struct: struct dl_phdr_info { ElfW(Addr) dlpi_addr; /* Base address of object */ const char *dlpi_name; /* (Null-terminated) name of object */ const ElfW(Phdr) *dlpi_phdr; /* Pointer to array of ELF program headers for this object */ ElfW(Half) dlpi_phnum; /* # of items in dlpi_phdr */ }; Here's my C# translation of the above struct: public struct dl_phdr_info { public System.UInt32 dlpi_addr; /* Base address of object */ // TODO: String, MarshalAs Pointer public System.IntPtr dlpi_name; /* (Null-terminated) name of object*/ /* Pointer to array of ELF program headers for this object */ public System.IntPtr dlpi_phdr; // Hackish, cannot read it, but then at least the rest works // This way it throws an exception at runtime. //[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPStruct)] //public Elf32_Phdr[] dlpi_phdr; public System.UInt16 dlpi_phnum; /* # of items in 'dlpi_phdr' */ } ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Embedding Mono
On 18 March 2011 10:48, vinay_rk vinay.kash...@ironmountain.com wrote: Hi, After several tests with Mono Embedding on Mac OSX on returning to Windows, I see that the first issue that I started this thread with is still the same on windows (Things seem to be fine on Mac). The code I have on windows is as follows: MonoDomain *domain; MonoAssembly *assembly; char *args[1]; args[0] = Test Param; //mono_config_parse(NULL); //mono_set_dirs(NULL,NULL); domain = mono_jit_init (C:\Work\CommonAgent\TestManagedAssembly\TestManagedAssembly\bin\Debug\TestManagedAssembly.exe); assembly = mono_domain_assembly_open (domain, C:\Work\CommonAgent\TestManagedAssembly\TestManagedAssembly\bin\Debug\TestManagedAssembly.exe); if (!assembly) printf(Error); else { mono_jit_exec (domain, assembly,1, args); } While mono_jit_init gets a valid looking pointer, the mono_domain_assembly_open returns a null pointer. Is this because of something I did wrong with the mono.lib I' am linking against.. ? I created the Mono.lib using the mono.def file and with the command: lib /nologo /def:mono.def /out:mono.lib /machine:x86. should I ensure the mono.def file is copied in some particular directory amongst the mono framework installation (directory structure) ? PS: If I try un-commenting the calls to either mono_config_parse or mono_set_dirs, then the mono_jit_init crashes without any particular exception. This is looking like a complete dead end as of now.. ! Regards -Vinay -- View this message in context: http://mono.1490590.n4.nabble.com/Embedding-Mono-tp3345310p3386882.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list Hi, You need to put double backslashes in your path name, as a single backslash is an escape character, in a string literal. e.g.: C:\\Work\\CommonAgent\\TestManagedAssembly\\TestManagedAssembly\\bin\\Debug\\TestManagedAssembly.exe Tom. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] File not found error when using Activator.CreateInstanceFrom()
Are you still talking about Windows-only here? -- Spink On 5 January 2011 14:25, mike mgu...@knology.net wrote: Anybody else see this while using P/Invoke under mono? -- View this message in context: http://mono.1490590.n4.nabble.com/File-not-found-error-when-using-Activator-CreateInstanceFrom-tp3064104p3175616.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] CompositeScriptReferenceEventArgs Object Not Found in SystemWeb.UI
Hello, This class is missing. Take a look here to see what's not implemented/missing in System.Web.Extensions, against .NET 3.5: http://go-mono.com/status/status.aspx?reference=3.5profile=2.0assembly=System.Web.Extensions -- Spink On 22 December 2010 10:43, haaroons haaro...@gmail.com wrote: Dear All, i am using mono-2.8.1 and i am trying to compile AJAXControlToolkit 3.5 4.0 getting compilation error for mono library stating CompositeScriptReferenceEventArgs Object Not Found Error. I have checked in the web CompositeScriptReferenceEventArgs belong to System.Web.UI Library. but if i searched in the mono mcs/class src folder no such object created. So please let me know whether mono support CompositeScriptReferenceEventArgs. This component present in microsoft framework 3.5 SP1 System.Web.UI library. Regards Haroon -- View this message in context: http://mono.1490590.n4.nabble.com/CompositeScriptReferenceEventArgs-Object-Not-Found-in-SystemWeb-UI-tp3160435p3160435.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] CompositeScriptReferenceEventArgs Object Not Found in SystemWeb.UI
Hi, As far as I can tell, there isn't anyone working on that particular class. You could have a go at implementing it yourself, and sending some patches! It's just an EventArgs class, so shouldn't be too hard to make. Of course, I'm not sure what else from that assembly your code is dependent on, so even if you do implement the CompositeScriptReferenceEventArgs class, chances are that you'll also need to implement a bunch of other classes. -- Spink On 23 December 2010 12:27, Haroon Raseed Sarbudeen haaro...@gmail.com wrote: Hi spink Thanks for the reply. Is there any idea this class available in forthcoming mono 3.0 release. On Dec 23, 2010, at 7:15 PM, Tom Spink tsp...@gmail.com wrote: Hello, This class is missing. Take a look here to see what's not implemented/missing in System.Web.Extensions, against .NET 3.5: http://go-mono.com/status/status.aspx?reference=3.5profile=2.0assembly=System.Web.Extensions -- Spink On 22 December 2010 10:43, haaroons haaro...@gmail.com wrote: Dear All, i am using mono-2.8.1 and i am trying to compile AJAXControlToolkit 3.5 4.0 getting compilation error for mono library stating CompositeScriptReferenceEventArgs Object Not Found Error. I have checked in the web CompositeScriptReferenceEventArgs belong to System.Web.UI Library. but if i searched in the mono mcs/class src folder no such object created. So please let me know whether mono support CompositeScriptReferenceEventArgs. This component present in microsoft framework 3.5 SP1 System.Web.UI library. Regards Haroon -- View this message in context: http://mono.1490590.n4.nabble.com/CompositeScriptReferenceEventArgs-Object-Not-Found-in-SystemWeb-UI-tp3160435p3160435.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono 2.8 regression
Hello, There doesn't seem to be any relation between S and T - which means the types are incompatible, and so not eligible for generic type parameter variance. The reason is, the abstract function definition specifies a type constraint 'T' and even though your overridden method signature is identical, it's using a different type constraint to the delegate definition and so the cast is not valid. So it looks like a bug in the Mono compiler was fixed - now you just need to fix the bug in your code! You can make them compatible (and hence eligible for variance) by specifying constraints, but in order to specify a constraint on the override method, you need to propagate that constraint to the abstract class. -- Spink On 20 December 2010 09:01, Federico Di Gregorio f...@initd.org wrote: Hi *, I guess it's my fault, not Mono's, but some code that compiled well on 2.6 doesn't work anymore on 2.8. I suppose this is somewhat related to covariance/contravariance of delegates but I'd like to have someone tell me «Eck! Whay did you do that? That's wrong!». Here is the error: test.cs(15,16): error CS0030: Cannot convert type `System.Funcstring,int,T' to `System.Funcstring,int,S' And here is the code: using System; using System.Collections.Generic; public abstract class A { public abstract Funcstring,int,T GetXXXT(); } public class CT : A { Funcstring,int,T xxx; public override Funcstring,int,S GetXXXS() { return (Funcstring,int,S)xxx; } } -- Federico Di Gregorio f...@initd.org To prepare such test data, I get into the meaniest, nastiest frame of mind that I can manage, and I write the cruelest code I can think of; then I turn around and I embed that in even nastier constructions that are almost obscene. -- D.E.Knuth ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono 2.8 regression
Hello, You could propagate the abstract method type parameter out to the class definition: /// public abstract class AT { public abstract Funcstring, int, T GetXXX(); } /// Then, override as follows: /// public class CT : AT { Funcstring, int, T xxx; public override Funcstring, int, T GetXXX() { return xxx; } } /// (or if you want to be absolutely terrible you could do this cast instead:) /// public override Funcstring,int,S GetXXXS() { return (Funcstring,int,S)(object)xxx; } /// (but if you ever tell anyone I told you to do that...) -- Spink On 20 December 2010 09:27, Federico Di Gregorio f...@initd.org wrote: On 20/12/2010 10:15, Jb Evain wrote: On Mon, Dec 20, 2010 at 10:01 AM, Federico Di Gregorio f...@initd.org wrote: I'd like to have someone tell me «Eck! Whay did you do that? That's wrong!». Eck! Why did you do that? That's wrong! (You're welcome ;) test.cs(15,16): error CS0030: Cannot convert type `System.Funcstring,int,T' to `System.Funcstring,int,S' Right, in the code you posted, there's no relation between T and S. So naturally, you can't convert from one to the other. Just as you can't convert Funcstring, int to Funcstring, string. So It's not a regression, it's more like a bug fix. Yep, the full subject was Mono 2.8 regression _in my code_. :) Now, there is any way to force such a cast (I am _sure_ S and T are exactly the same type)? If not, alas, I can write slightly more complicated code to do the same thing... federico -- Federico Di Gregorio f...@initd.org I terminali seriali sono in via di estinzione (infatti quello che c'era si è estinto) -- Simone Caldana ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono 2.8 regression
It should run fine, as it's /probably/ doing what the cast to object is doing... But, of course, it violates type-safety so the compiler moans at you. Like I suggested, if you cast to object, then cast to the delegate, this'll get round the compilation error. -- Spink On 20 December 2010 11:09, Federico Di Gregorio f...@initd.org wrote: On 20/12/2010 11:11, Tom Spink wrote: You could propagate the abstract method type parameter out to the class definition: Unfortunately I can't have a generic abstract class because I need: DictionaryType,A precompiledExpressionsByType; and then, in other parts of the library: X result = precompiledExpressionsByType[typeof(X)] .evaluateSuchAndSuchExprX(param1, param2, ...); where evaluateSuchAndSuchExpr() is a method of A (GetXXX in my previous email). Anyway, thank you all for confirming this was a bug in my code[*]; I'll fix it using a different approach. federico [*] In fact the code runs fine, even on MS.NET, when compiled with Mono 2.6. -- Federico Di Gregorio f...@initd.org Ubuntu is an ancient African word meaning I can't configure Debian. -- somewhere on IRC -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Referring to libraries on the command line
Hi Russel, Did you say you were using make? If so, you can be clever in make like this: /// LIBS := $(wildcard *.dll) REFS := $(foreach LIB,$(LIBS),-r:$(LIB)) /// Then, you can use $(REFS) on the gmcs command-line, like this: gmcs ... $(REFS) ... (where the ellipses is your already existing command-line) This will populate all the DLLs in the current directory into LIBS, then generate the references command-line in REFS. Hope this helps, Tom. On 14 July 2010 07:16, Russell Wallace russell.wall...@gmail.com wrote: I'm trying to compile a program with gmcs, which wants references to all libraries in the current directory. Normally one would specify this with *.dll, but because gmcs wants a prefix of -r: in each case, this breaks. Is there any way to obtain this effect, e.g. some way to expand a wild card and then prepend a prefix to each expanded name? (Ubuntu Linux, make under bash, if it matters.) ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Create a 'MonoImage' from a byte array.
Hi, I don't think you've told us the problem! Tom. On 6/16/10, Thiago Padilha tpadilh...@gmail.com wrote: I'm trying to create a MonoImage/MonoAssembly from a byte array like this : //body omited, this is a simple function that return contents of a binary file and returns the file size in bytes as an out parameter static char *read_file_contents(char *fullpath, int *outfilesize); static MonoImage *get_image(char *data, char *name, char *size) { return mono_image_open_from_data_with_name (data, size, 0, MONO_IMAGE_OK, 0, name); } MonoAssembly *get_assembly_from_file(char *name) { int size = 0; MonoAssembly *ret = NULL; MonoImage *image = get_image_from_file(fullpath); if(image != NULL) ret = mono_assembly_load_from_full(image, fullpath, MONO_IMAGE_OK, 0); free(fullpath); return ret; } ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Sent from my mobile device Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Make System.IO.Ports work on UNIX systems other than Linux
Hi guys, We may be able to get some hints from the sysfs filesystem, if running on Linux. In /sys/class/tty, we have the available TTY ports - whether or not they're physical serial ports is another issue - but maybe it doesn't matter. If on Linux, and the /sys/class/tty directory is available, it may suffice to allow a port that is present there. -- Tom On 22 April 2010 18:48, Andreas Färber andreas.faer...@web.de wrote: Hi, Am 22.04.2010 um 18:45 schrieb Robert Nagy: Can someone please have a look at this? On (2010-04-20 23:26), Robert Nagy wrote: The attached diff makes SerialPort.GetPortNames() work on all Unix systems other than Linux too, because ttyS* and ttyUSB* is linux specific and on *BSD the serial ports are tty[0-9]+. (I've tested this code on Linux and it should also support ttySG0 (SGI running Linux (ia64)). The other way would be to add a different platform id for *BSDs. Comments? (My C# is not good :)) Index: class/System/System.IO.Ports/SerialPort.cs === --- class/System/System.IO.Ports/SerialPort.cs (revision 155801) +++ class/System/System.IO.Ports/SerialPort.cs (working copy) @@ -24,6 +24,7 @@ using System.ComponentModel; using System.Diagnostics; using System.Text; +using System.Text.RegularExpressions; using System.Runtime.InteropServices; using Microsoft.Win32; @@ -525,10 +526,18 @@ // Are we on Unix? if (p == 4 || p == 128 || p == 6) { string[] ttys = Directory.GetFiles(/dev/, tty*); + Regex lnx = new Regex(@^\/dev\/tty(S(G)?|USB)[0-9]+$); I'm not a Linux expert, but I think the regex still may be incomplete. For instance, I've seen tty0 (virtio), ttyPZ0 (ppc), ttySC0 (sh4 R2D), ttyAMA0 (arm RealView) as kernel parameters. + Regex rem = new Regex(@^\/dev\/tty(U)?[0-9]+$); + foreach (string dev in ttys) { - if (dev.StartsWith(/dev/ttyS) || dev.StartsWith(/dev/ ttyUSB)) - serial_ports.Add(dev); + if (lnx.Match(dev).Success) + rem = lnx; + serial_ports.Add(dev); } + for (int i = serial_ports.Count - 1; i = 0; i--) { + if (!rem.Match(serial_ports[i]).Success) + serial_ports.RemoveAt(i); + } This seems overly complicated to me. Both the variable naming and cross-assignment and the first-add-then-remove approach. I think we should either try to find one universal regex like /dev/ tty[A-Z]*[0-9]+ or initialize the regex based on platform. Either way we'd hopefully have one regex we could use to add to the list and could drop the second loop. Platform identification could be done by recognizing a non-Windows platform and p/invoking uname. Andreas ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Can run my apps
Hi, I think the OP is posting to the wrong mailing list. He/she needs to be posting to the monodevelop mailing list. The problem is a MonoDevelop problem, not a Mono problem. -- Tom On 17 February 2010 20:53, Stifu st...@free.fr wrote: How about showing your application source code? -- View this message in context: http://n4.nabble.com/Can-run-my-apps-tp1556267p1559316.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] faster than hashtable?
2009/10/27 psant...@codicesoftware.com psant...@codicesoftware.com: Hi, If you need to store key/value pairs, where the key will be ALWAYS a unique long (no collisions), is there anything better than a Hashtable? Thanks pablo Presumably, though, the key can span the entire range of a long? If it's an acceptably small range, you could use an array. -- Tom Spink ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono's reflection implementation
Hi Kris, 2009/9/10 Kris Mok rednaxela0...@hotmail.com: You're right that BindingFlags.NonPublic doesn't return inherited fields. Looks like I should have sent a bug report to MS instead :) It's not a bug. You need to specify BindingFlags.FlattenHierarchy. -- Tom Spink Ogden Nash - The trouble with a kitten is that when it grows up, it's always a cat. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono's reflection implementation
2009/9/10 Robert Jordan robe...@gmx.net: Nope. Please check the docs to see why. Touché! You know, I remember writing some code a while ago to recursively flatten the hierarchy for this very reason... but I forgot the OP was looking for *private* members. -- Tom Spink Charles de Gaulle - The better I get to know men, the more I find myself loving dogs. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] [Gtk-sharp-list] Gtk depends on Win forms ¿?
Hi Stefanos, 2009/9/9 Stefanos A. stapos...@gmail.com: What magic sauce is Application.DoEvents using? I wonder if it is performing any static initialization (static constructors and/or fields). That is what I thought, so I went on a hunt... but couldn't find anything conclusive. I paid particular attention to the static constructor of the Application class - maybe I overlooked something elsewhere! -- Tom Spink Mike Ditka - If God had wanted man to play soccer, he wouldn't have given us arms. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Gtk depends on Winforms ¿?
2009/9/6 Christian Hoff christian_h...@gmx.net: As I said, nobody has ever found out what DoEvents does and why produces the desired results. We'd really like to avoid loading SWF at runtime, but so far nobody has come up with a better solution :-) . Just to pitch in, I remember *ages* ago when XP first introduced visual styles, a manifest was required to specify using the common controls library version 6, but also a call to InitCommonControlsEx was required: [DllImport(comctl32.dll)] public static extern bool InitCommonControlsEx(IntPtr lpInitCtrls); I've just rattled that off my brain, and the MSDN page: http://msdn.microsoft.com/en-us/library/bb775697%28VS.85%29.aspx I can't test this, since I don't have a suitable test environment. But, it may point someone in the right direction. -- Tom Spink Marie von Ebner-Eschenbach - Even a stopped clock is right twice a day. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Gtk depends on Winforms ¿?
2009/9/6 Christian Hoff christian_h...@gmx.net: Unfortunately, I do not have an XP machine, either. In a few years when nobody is using this OS any more, we can drop this hackish workaround anyway. Until then, we will probably have to treat the whole thing as a blackbox ;-) . Nevertheless, if someone comes up with a better solution, we'd be happy to commit it. Does that mean it works without the hack on Vista? Christian -- Tom Spink Mike Ditka - If God had wanted man to play soccer, he wouldn't have given us arms. - http://www.brainyquote.com/quotes/authors/m/mike_ditka.html ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] About recursivily and setters / getters
2009/9/6 Romain Tartière rom...@blogreen.org: I guess this crash is somewhat violent. Should a bug be opened for this? Any comment? It's crashing because it's a stack overflow. A recursive call will never result in an infinite loop, because each call to itself pushes a new stack frame onto the stack. Eventually (well, quite quickly in fact!), the stack will fill up and you'll get a stack overflow exception. (which is what I get, when I execute your program on my system) -- Tom Spink Pablo Picasso - Computers are useless. They can only give you answers. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] About recursivily and setters / getters
Hi Romain, 2009/9/6 Romain Tartière rom...@blogreen.org: I need sleep or coffee I guess. I will admit, I've just brewed the Starbucks house blend :) -- Tom Spink Ogden Nash - The trouble with a kitten is that when it grows up, it's always a cat. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] WinForms Control.Invoke Issue
2009/8/8 Carlos Alberto Cortez calberto.cor...@gmail.com: Hey! I had been reviewing some patches we have in bugzilla - but I missed this one. It's now reviewed - see bugzilla ;-) Thanks! Carlos. 2009/8/7 Tom Spink tsp...@gmail.com Hi Guys, I filed a bug a while ago about an issue with Control.Invoke in WinForms. A guy said he'd take a look at a patch, if I posted one, which I did... but nothing has come of it. I tried e-mailing the WinForms list, but haven't heard anything back. I was wondering if someone here could take a look at my proposed patch? Here's the BugZilla entry: https://bugzilla.novell.com/show_bug.cgi?id=497175 Thanks! -- Tom Spink Pablo Picasso - Computers are useless. They can only give you answers. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list Hi Carlos, Thanks for your time! I've updated the patch, should be in BugZilla now. -- Tom Spink Samuel Goldwyn - I'm willing to admit that I may not always be right, but I am never wrong. - http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] WinForms Control.Invoke Issue
Hi Guys, I filed a bug a while ago about an issue with Control.Invoke in WinForms. A guy said he'd take a look at a patch, if I posted one, which I did... but nothing has come of it. I tried e-mailing the WinForms list, but haven't heard anything back. I was wondering if someone here could take a look at my proposed patch? Here's the BugZilla entry: https://bugzilla.novell.com/show_bug.cgi?id=497175 Thanks! -- Tom Spink Pablo Picasso - Computers are useless. They can only give you answers. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list