Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing an array by reference to a .NET .dll
Message
 
À
08/04/2008 10:24:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
01309001
Message ID:
01309018
Vues:
24
This message has been marked as the solution to the initial question of the thread.
Hi David:

Use the function CLRCreateArray as
oArray = CLRCreateArray(tcType, tnDim1, tnDim2)
To create your array in VFP.

Fill it using
oArray.SetValue(teVal, tnIndex)
And just pass it to your method it will have the new data if your method modifies the array.

There is even one more option to speed up things with arrays avoiding the marshaling needed for VFP.
oExtender = GetCLRExtender()
oExtender.oExtender.bMarshalArrays = .T.
Now the methods returning arrays will return .NET Arrays instead of VFP Arrays.

This is only needed under VFP using the .NET Extender. The compiler works directly with .NET arrays using the [] or () notation.


>I've pretty much read up on how to get a Visual FoxPro app and a .Net (in my case, Visual Basic 2008) .dll to talk to each other, and I'm all set to do so. But I just remembered that there's one more potential fly in the ointment that may prove troublesome.
>
>In one of my method calls, there is a pass by reference of an array - I need to send in an array, get it filled with information, and get it sent back to the calling application. Now, I just remembered that VFP's arrays are unmanaged memory, while .NET's arrays are instances of System.Array. Will appropriate adjustment be made for that? Or do I need to rethink my strategy - come up with some with some other way to passing back that list (it's one dimensional) of information?
>
>Any thoughts?
>
>David
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform