 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Ade
Joined: 20 Jul 2010 Posts: 6
|
Posted: Thu Sep 16, 2010 5:01 pm Post subject: Calling .NET methods from FTN95 with enums |
|
|
The code below gives error 1119 - No .NET method matches this call.
Code: |
SUBROUTINE TESTIT(MDL)
C
LIBRARY("MTSL.Data.dll")
ASSEMBLY_EXTERNAL(NAME="MTSL.Data.Model.Count") MODELCOUNT
C
OBJECT("MTSL.Data.Model") MDL
CHARACTER(LEN=24),PARAMETER::OBJECTTYPE="MTSL.Data.MTSLObjectType"
C
INTEGER*4 NUM
C
NUM = MODELCOUNT(MDL, OBJECTTYPE%otPoint)
C
WRITE(*,*) NUM
C
RETURN
END
|
MTSL.Data.dll was written with C#. The class 'Model' has a method 'Count' that takes an enum as a parameter to return the number of items of that type. An instance of a 'Model' is passed to the FTN95 routine. _________________ Adrian Paveling
Systems Developer
McCarthy Taylor Systems Ltd
www.dtmsoftware.com |
|
Back to top |
|
 |
silverfrost Site Admin

Joined: 29 Nov 2006 Posts: 193 Location: Manchester
|
Posted: Mon Oct 04, 2010 2:38 pm Post subject: |
|
|
I am assuming here that otPoint is an enum value? How is it declared (jn the C#)? |
|
Back to top |
|
 |
Ade
Joined: 20 Jul 2010 Posts: 6
|
Posted: Fri Oct 08, 2010 10:40 am Post subject: |
|
|
C# declaration of enum MTSLObjectType in MTSL.Data.dll -
Code: |
/// <summary>
/// An enumeration to identify MTSL object types.
/// </summary>
public enum MTSLObjectType
{
otDataObject,
otAttribObject,
otRefObject,
otAttribRefObject,
// Main data types...
otStation,
otSetup,
otObservation,
otControl,
otPoint,
otTriangle,
otLink,
otText,
// Main survey types...
otModel,
// Add new types below...
otNonTerrainNode,
otLoadFile,
otPointCode,
otLinkCode,
otSurfaceCode,
otLegend,
otModelDisplay
}
|
Declaration of Method Model.Count in MTSL.Data.dll -
Code: |
/// <summary>
/// Summary description for ModelClass.
/// </summary>
public class Model : MTSLAttributeDataObject
{
...
...
public int Count(MTSLObjectType ObjectType)
{
ArrayList arr = GetList(ObjectType);
if (arr == null) return 0;
return arr.Count;
}
public ArrayList GetList(MTSLObjectType ObjectType)
{
switch (ObjectType)
{
case MTSLObjectType.otStation: return (ArrayList)FData[2];
case MTSLObjectType.otSetup: return (ArrayList)FData[3];
case MTSLObjectType.otControl: return (ArrayList)FData[4];
case MTSLObjectType.otObservation: return (ArrayList)FData[5];
case MTSLObjectType.otPoint: return (ArrayList)FData[6];
case MTSLObjectType.otLink: return (ArrayList)FData[7];
case MTSLObjectType.otTriangle: return (ArrayList)FData[8];
case MTSLObjectType.otText: return (ArrayList)FData[9];
case MTSLObjectType.otNonTerrainNode: return (ArrayList)FData[16];
case MTSLObjectType.otLoadFile: return (ArrayList)FData[17];
default: return null;
}
}
...
...
}
|
_________________ Adrian Paveling
Systems Developer
McCarthy Taylor Systems Ltd
www.dtmsoftware.com |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|