Using unmanaged dll in c#: how to marshal a struct
From: Thomas183 (gogglwoggl_at_gmx-dot-de.no-spam.invalid)
Date: 03/18/04
- Next message: Abhijeet Dev: "Re: How to highlight records in datagrid ?"
- Previous message: Tonyukuk: "How can I make a method thad create matrix?"
- Next in thread: Marcin Grzębski: "Re: Using unmanaged dll in c#: how to marshal a struct"
- Reply: Marcin Grzębski: "Re: Using unmanaged dll in c#: how to marshal a struct"
- Messages sorted by: [ date ] [ thread ]
Date: 18 Mar 2004 16:51:14 -0600
Hi,
I have a unmanaged c++ dll, and want to call a function
"dlltest(mystruct a)"of it.
The Parameter mystruct is a struct which consists of a array of
strings:
struct mystruct
{
char * myArray[100];
}
I searched the net for on hole day, to find a way to marshal this.
I have tried the following in C#:
[ StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct x_struct
{
[MarshalAs(UnmanagedType.LPArray, SizeConst=2)]
public [] string d;
};
[DllImport ("MyFile.dll", callingConvention.StdCall)]]
public static extern string dlltest(x_struct X);
The dll is in the system32 dir and functions with other structs (only
int) worked fine.
But with this one i get a EntryPointNotFound exception.
Thanks for your help
Thomas
mailto: gogglwoggl@gmx.de
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
- Next message: Abhijeet Dev: "Re: How to highlight records in datagrid ?"
- Previous message: Tonyukuk: "How can I make a method thad create matrix?"
- Next in thread: Marcin Grzębski: "Re: Using unmanaged dll in c#: how to marshal a struct"
- Reply: Marcin Grzębski: "Re: Using unmanaged dll in c#: how to marshal a struct"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|