[Mono-dev] Interop with Native Libraries Question

2008-03-05 Thread Sebi Onofrei

Hello everyone.

Please help me translating one function in the correct way

I have a library from which I have to use some methods which is written 
in C++.


The method I need to correctly translate is this:
*integer method_name(const void* a_handle, char* name, int* length)*

Now, what I tried looks like this:
*[DllImport (libraryName, EntryPoint = "method_name", CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
   private static unsafe extern integer EXT_method_name(void* 
handle, out string name, out int length);*


when I test the code I receive an integer that informs me that I 
delivered Invalid parameters


Next I tried  this:
*[DllImport (libraryName, EntryPoint = "method_name", CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
   private static unsafe extern integer EXT_method_name(void* 
handle, StringBuilder name, ref int length);*

this doesn't work either

Then I tried this:
*[DllImport (libraryName, EntryPoint = "method_name", CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
   private static unsafe extern integer EXT_method_name(IntPtr 
handle, StringBuilder name, out int length);*

and this doesn't work either :(


I have a similar method which works and looks like this:
*integer method_name(const void* a_handle, int* length)

*And my working "translation" is this:
*[DllImport (libraryName, EntryPoint = "method_name", CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
   private static unsafe extern integer EXT_method_name(void* 
handle, out int length);*



Any ideas about what I did wrong? I'm a total newbie with Interop 
communication :)


I understood correctly that when I pass strings as parameters to that 
external method I have to Marshal them, but when I need strings as 
output... how

should I do this?

In mono's wiki there is an example with StringBuilder (the strncpy 
example), but either I did something wrong or some different approach is 
needed.



Thank you for all your efforts in helping me


With kind regards,
Sebastian
begin:vcard
fn:Sebi Onofrei
n:Onofrei;Sebastian
org:Eyepartner Inc.;C# & Delphi development
adr:;;Luca Arbore, 18, 512A, P/1;Iasi;Iasi;;Romania
email;internet:[EMAIL PROTECTED]
title:Mr
tel;work:+40 745 337579
tel;home:+40 332 443465
tel;cell:+40 765 133948
note;quoted-printable:Hello,=0D=0A=
	=0D=0A=
	In case any problems related with Monster Encoder or Deskshare applicatio=
	ns appear, please feel free to create/update a proper ticket containing=
	 some relevant details about the involved problem and notify me.=0D=0A=
	=0D=0A=
	Thank you
x-mozilla-html:TRUE
url:http://onofrei.org
version:2.1
end:vcard

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Interop with Native Libraries Question

2008-03-05 Thread Jonathan Pryor
On Wed, 2008-03-05 at 12:09 +0200, Sebi Onofrei wrote:
> I have a library from which I have to use some methods which is
> written in C++.

First, make sure the C++ methods are declared `extern "C"`.

> The method I need to correctly translate is this:
> integer method_name(const void* a_handle, char* name, int* length)

Do you have the source code to `method_name' that you can provide?

What is the actual type of `integer'?

void* is usually an IntPtr.

Is `name' an input parameter or an output parameter?  If `name' is an
input parameter, it should be `string' in your P/Invoke.  If it's an
output parameter (e.g. the `dest' parameter in strcpy(3)), StringBuilder
should work.

Does `length' need to have a valid value before the call?  If it does,
`ref int' should be used, otherwise `out int'.

> Next I tried  this:
> [DllImport (libraryName, EntryPoint = "method_name", CharSet =
> CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
> private static unsafe extern integer EXT_method_name(void*
> handle, StringBuilder name, ref int length);
> this doesn't work either

In what way doesn't this work?  `integer' isn't a valid C# type (unless
it's a type of your own creation).

> Then I tried this:
> [DllImport (libraryName, EntryPoint = "method_name", CharSet =
> CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
> private static unsafe extern integer EXT_method_name(IntPtr
> handle, StringBuilder name, out int length);
> and this doesn't work either :(

Again, in what way does this fail?

Also keep in mind that the StringBuilder needs to have space allocated
*before* the method call; see:

  http://mono-project.com/Dllimport#Passing_Caller-Modifiable_Strings

> In mono's wiki there is an example with StringBuilder (the strncpy
> example), but either I did something wrong or some different approach
> is needed.

Alas, without seeing the caller-side code, it's difficult to say.  My
best guess is that you're not providing a Capacity to the StringBuilder
instance you provide.

It would also be helpful to know in what way the method is failing.

 - Jon


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] NUnit in Mono.

2008-03-05 Thread Leszek Ciesielski
On Tue, Dec 18, 2007 at 5:07 AM, Charlie Poole <[EMAIL PROTECTED]> wrote:
> Hi Miguel,
>
>  Apparently, nobody else remembers either. :-)
>
>  I suggest upgrading to 2.4.x if possible, and I'll take on any
>  bug fixes to NUnit needed to make it happen.
>
>  Charlie
>
>
>  > -Original Message-
>  > From: [EMAIL PROTECTED]
>  > [mailto:[EMAIL PROTECTED] On Behalf
>  > Of Miguel de Icaza
>  > Sent: Wednesday, December 12, 2007 1:51 PM
>  > To: mono-devel-list
>  > Subject: [Mono-dev] NUnit in Mono.
>  >
>
>
> > Hello,
>  >
>  > Currently we ship NUnit 2.2.0 with Mono, and am wondering
>  > if we should be upgrading to a newer version of NUnit, and
>  > include all the assemblies that we do not seem to be distributing.
>  >
>  > I do not remember the reasons that we had to keep the
>  > NUnit at the current version.

Hi,

has anyone looked into this? Will mono ship NUnit 2.4.6?
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Possible bug in r97246 - trunk/mcs/class/System.Drawing/System.Drawing

2008-03-05 Thread Ivan N. Zlatev
I will look into this tomorrow, cheers.

On Tue, Mar 4, 2008 at 9:40 AM, Andreas Nahr
<[EMAIL PROTECTED]> wrote:
> The change in r97246 is likely buggy, because the comparison is now done on
>  the current locale but should likely be ordinalIgnoreCase or
>  InvariantIgnoreCase.
>
>  Happy Hacking
>  Andreas
>
>  ___
>  Mono-devel-list mailing list
>  Mono-devel-list@lists.ximian.com
>  http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



-- 
Ivan N. Zlatev

Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Installing policy file in the GAC?

2008-03-05 Thread Michi Henning
Hi,

I'm writing an install script that places an assembly into the GAC using 
gacutil.
However, with the assembly, I also need to install a policy file to control
backward compatibility with previous version. I know that the policy file
needs to go into the lib/mono/gac directory. But how do I get it there?

gacutil won't install a policy file in the GAC because the policy file isn't
an assembly. So, obviously, I have to copy it there from the install script.
But how can the install script find out where Mono is installed? Is there
any command I can use to get at the Mono installation directory?

Thanks,

Michi.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Installing policy file in the GAC?

2008-03-05 Thread Carlos Alberto Cortez


> 
> gacutil won't install a policy file in the GAC because the policy file isn't
> an assembly. So, obviously, I have to copy it there from the install script.
> But how can the install script find out where Mono is installed? Is there
> any command I can use to get at the Mono installation directory?
> 

You don't copy the file directly - but use the assembly linker (al.exe)
to create an assembly based on the configuration file:


al /link:policy-file.config /out:policy.1.0.YourAssembly.dll 
/keyfile:YourAssemblyKey.snk

then you can just gacutil on the generated assembly:

gacutil -i policy.1.0.YourAssembly.dll

See http://msdn2.microsoft.com/en-us/library/dz32563a(vs.71).aspx

Carlos.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Mono 1.9.0 Preview 4 is out!!

2008-03-05 Thread Thomas Wiest
Hey Everyone,
We've just released Mono 1.9.0 Preview 4 today! Please help us out by 
giving it a try with your applications.

As always, you can get the preview releases here:
http://mono.ximian.com/monobuild/preview/download-preview/

Please report any bugs that you may find using our Bugs page, AND reply to this 
thread with the bug numbers so we can track them!
http://www.mono-project.com/Bugs

You can see the bugs we're tracking for Mono 1.9.0 here:
https://bugzilla.novell.com/buglist.cgi?bug_file_loc_type=allwordssubstr&bug_file_loc=http%3A%2F%2Fwww.go-mono.com%2Farchive%2F1.9%2F&order=bugs.bug_status%20


The earlier you file the bugs and reply to this message, the more likely your 
bugs will get fixed.

Special attention is given to regressions, so if you can tell us a version of 
Mono where the bug worked and you tag the summary of the bug with
[Regression], then it is much more likely your bug will get fixed.

Please help the Mono team to make 1.9.0 the best release of Mono ever.

Thanks again!

Mono QA

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Host offer

2008-03-05 Thread Sebi Onofrei

Hello everyone,

I bought some time ago a host / domain and I have no time at the moment 
to use it.

So, can you use it for mirroring purposes?

Total disk space: 5Gb
Per month traffic limit: 250Gb

hosted by godaddy


I would really like to set-up some sort of mirroring there, even with 
apt / yum support, etc

So if this will help you, please let me know


With kind regards,
Sebi
begin:vcard
fn:Sebi Onofrei
n:Onofrei;Sebastian
org:Eyepartner Inc.;C# & Delphi development
adr:;;Luca Arbore, 18, 512A, P/1;Iasi;Iasi;;Romania
email;internet:[EMAIL PROTECTED]
title:Mr
tel;work:+40 745 337579
tel;home:+40 332 443465
tel;cell:+40 765 133948
note;quoted-printable:Hello,=0D=0A=
	=0D=0A=
	In case any problems related with Monster Encoder or Deskshare applicatio=
	ns appear, please feel free to create/update a proper ticket containing=
	 some relevant details about the involved problem and notify me.=0D=0A=
	=0D=0A=
	Thank you
x-mozilla-html:TRUE
url:http://onofrei.org
version:2.1
end:vcard

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Installing policy file in the GAC?

2008-03-05 Thread Michi Henning
Michi Henning wrote:
> But how can the install script find out where Mono is installed? Is there
> any command I can use to get at the Mono installation directory?
Never mind, I figured it out.

Thanks,

Michi.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list