Click here to Skip to main content
15,949,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart19-Apr-04 4:44
protectorHeath Stewart19-Apr-04 4:44 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep19-Apr-04 18:03
Vini Deep19-Apr-04 18:03 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart20-Apr-04 3:13
protectorHeath Stewart20-Apr-04 3:13 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep20-Apr-04 19:53
Vini Deep20-Apr-04 19:53 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart21-Apr-04 3:07
protectorHeath Stewart21-Apr-04 3:07 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep22-Apr-04 2:25
Vini Deep22-Apr-04 2:25 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart22-Apr-04 2:43
protectorHeath Stewart22-Apr-04 2:43 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep22-Apr-04 20:36
Vini Deep22-Apr-04 20:36 
Sorry about this. I very much appretiate your help Rose | [Rose] . Still a basic doubt:

Heath Stewart wrote:
[StructLayout(LayoutKind.Sequential)]
public struct FirstStruct
{ 
   [MarshalAs(UnmanagedType.R4)] public double XSpeed;  
   [MarshalAs(UnmanagedType.SysInt)] public IntPtr DRate;  
   [MarshalAs(UnmanagedType.SysUInt)] public IntPtr RotCtrl;   
   // ctor added for convenience and example.  
   public FirstStruct(double XSpeed, long DRate, long RotCtrl)  
   {    
     this.XSpeed = XSpeed;    
     this.DRate = new IntPtr(DRate);    
     this.RotCtrl = new IntPtr(RotCtrl);  
   }
}

Is there any problem if I declare the structure as
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct FirstStruct
{
	public System.Double  XSpeed;
	public System.Int32   DRate;
	public System.UInt32  RotCtrl;

}

If I want to call a function from a dll written in C++ from my c# client, what should I do? Should I create a similar C# structure with managed DataTypes and use that to call the c++ dll function from my C# client, then use it to get the values returned by the Dll
OR
Should I create a similar structure in C# with Unmanaged Type data and then pass it to the function exported by the Dll and use the values returned?

Is the above both declaration one and the same? I have used [MarshalAs(UnmanagedType.ByValTStr, ....)] only in places where the variable declared was char[].
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] public string Vendor;

When I debug the program, at the function call I get an 'ExecutionEngineException'. Is it the problem which the marshaling of the structure array?

Kindly help.


Vini
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart23-Apr-04 2:05
protectorHeath Stewart23-Apr-04 2:05 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep25-Apr-04 22:30
Vini Deep25-Apr-04 22:30 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart26-Apr-04 2:56
protectorHeath Stewart26-Apr-04 2:56 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep26-Apr-04 19:42
Vini Deep26-Apr-04 19:42 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
poda21-Sep-10 0:16
poda21-Sep-10 0:16 
QuestionWhy didn't my raw socket work properly? Pin
pdsinfo18-Apr-04 18:29
pdsinfo18-Apr-04 18:29 
Generalwrapping .TLB to .DLL for .NET Pin
normanordas18-Apr-04 18:14
normanordas18-Apr-04 18:14 
GeneralRe: wrapping .TLB to .DLL for .NET Pin
Heath Stewart19-Apr-04 4:47
protectorHeath Stewart19-Apr-04 4:47 
GeneralRe: wrapping .TLB to .DLL for .NET Pin
normanordas22-Apr-04 16:04
normanordas22-Apr-04 16:04 
GeneralRe: wrapping .TLB to .DLL for .NET Pin
Heath Stewart23-Apr-04 1:53
protectorHeath Stewart23-Apr-04 1:53 
GeneralShowing custom tooltip Pin
Meysam Mahfouzi18-Apr-04 17:57
Meysam Mahfouzi18-Apr-04 17:57 
GeneralRe: Showing custom tooltip Pin
Heath Stewart19-Apr-04 4:49
protectorHeath Stewart19-Apr-04 4:49 
GeneralDotNet version problem Pin
azusakt18-Apr-04 16:09
azusakt18-Apr-04 16:09 
GeneralRe: DotNet version problem Pin
scadaguy18-Apr-04 16:49
scadaguy18-Apr-04 16:49 
Generalwindows media web control Pin
Marveyles18-Apr-04 15:11
Marveyles18-Apr-04 15:11 
GeneralRe: windows media web control Pin
Heath Stewart19-Apr-04 4:09
protectorHeath Stewart19-Apr-04 4:09 
Generalc# oledbdataadapter using access db and asp Pin
MeterMan18-Apr-04 13:23
MeterMan18-Apr-04 13:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.