Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #5133 > unrolled thread

Access to VO Function with Return Type ARRAY from C#

Started byKai Michael Poppe <kmpams@gmail.com>
First post2013-04-24 05:10 -0700
Last post2013-04-24 14:22 +0000
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Access to VO Function with Return Type ARRAY from C# Kai Michael Poppe <kmpams@gmail.com> - 2013-04-24 05:10 -0700
    Re: Access to VO Function with Return Type ARRAY from C# "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-04-24 14:28 +0200
      Re: Access to VO Function with Return Type ARRAY from C# Kai Michael Poppe <kmpams@gmail.com> - 2013-04-24 06:02 -0700
    Re: Access to VO Function with Return Type ARRAY from C# Malcolm G <malcolm-news2012delete@delete.jobstream.com> - 2013-04-24 14:11 +0100
      Re: Access to VO Function with Return Type ARRAY from C# Kai Michael Poppe <kmpams@gmail.com> - 2013-04-24 14:22 +0000

#5133 — Access to VO Function with Return Type ARRAY from C#

FromKai Michael Poppe <kmpams@gmail.com>
Date2013-04-24 05:10 -0700
SubjectAccess to VO Function with Return Type ARRAY from C#
Message-ID<3bcf2b08-aae8-4c5b-a2dd-b015f4e03bcb@googlegroups.com>
Hi NG!

I am trying to Access a VO-DLL-function from C#. This works with Returns in String, Integer or Logical.

Trying to Access an ARRAY return (Array of Integer) C# won't marshall the return value.

Anybody here who might know how to get this working?

Thanks and regards to y'all

Kai

[toc] | [next] | [standalone]


#5135

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2013-04-24 14:28 +0200
Message-ID<atq1f8F3rp0U1@mid.individual.net>
In reply to#5133
Hi Kai,

> I am trying to Access a VO-DLL-function from C#. This works with
> Returns in String, Integer or Logical.
> 
> Trying to Access an ARRAY return (Array of Integer) C# won't marshall
> the return value.


this cannot work because C# does not know about VO arrays.

You need to convert this array to a string in VO and reconvert from
string to list or array in C#.

Wolfgang



-- 

[toc] | [prev] | [next] | [standalone]


#5138

FromKai Michael Poppe <kmpams@gmail.com>
Date2013-04-24 06:02 -0700
Message-ID<abece2db-209e-4186-8541-9b1073a16dce@googlegroups.com>
In reply to#5135
Hi Wolfgang,

> this cannot work because C# does not know about VO arrays.
> 
> You need to convert this array to a string in VO and reconvert from
> string to list or array in C#.

This is not an Option as I need exactly this Array for the DLL to be included within the rest of the System properly. 

Additionally, I can't add another function to the DLL to return the Array as a string list because I Need to be able to check "old" DLLs as well (this is Projects with old Systems).

Had hoped for a different answer, but thanks anyway!

Kai

[toc] | [prev] | [next] | [standalone]


#5139

FromMalcolm G <malcolm-news2012delete@delete.jobstream.com>
Date2013-04-24 14:11 +0100
Message-ID<eSQdt.93956$ZX4.54473@fx08.fr7>
In reply to#5133
On 24/04/2013 13:10, Kai Michael Poppe wrote:
> Hi NG!
> 
> I am trying to Access a VO-DLL-function from C#. This works with Returns in String, Integer or Logical.
> 
> Trying to Access an ARRAY return (Array of Integer) C# won't marshall the return value.
> 
> Anybody here who might know how to get this working?

if it works with strings I suspect you can get it to work, with great
care. The in memory data structure of the VO array type is not that hard
to reverse engineer, I would start by claiming the function returns an
intptr and digging around from that. (The big worry would be the VO GC
moving things but that can only happen when you are in VO code)

(I have never done raw ptr work with C# but I think it is possible)

[toc] | [prev] | [next] | [standalone]


#5141

FromKai Michael Poppe <kmpams@gmail.com>
Date2013-04-24 14:22 +0000
Message-ID<kl8prf$ggu$1@dont-email.me>
In reply to#5139
Hi Malcom!

> if it works with strings I suspect you can get it to work, with great
> care. The in memory data structure of the VO array type is not that hard
> to reverse engineer, I would start by claiming the function returns an
> intptr and digging around from that. (The big worry would be the VO GC
> moving things but that can only happen when you are in VO code)

IntPtr was my second guess. I actually managed to have C# not throw any 
exceptions when using IntPtr, yet the returned values did not match 
anything I would expect...

Until I used Marshal.Copy ( IntPtr source, int[] dest, 0, 128 ) - the 
values that were actually returned started somewhere around array index 
15. I quite can't figure out why, but with a few more line of code I can 
solve my problem :)

Thanks for your suggestions!

Regards

Kai

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web