Click here to Skip to main content
15,924,193 members
Home / Discussions / C#
   

C#

 
GeneralRe: Updating Winforms and multi-threading [modified] Pin
Jergosh6-Mar-08 9:09
Jergosh6-Mar-08 9:09 
GeneralRe: Updating Winforms and multi-threading Pin
led mike6-Mar-08 9:26
led mike6-Mar-08 9:26 
GeneralRe: Updating Winforms and multi-threading Pin
Luc Pattyn6-Mar-08 9:16
sitebuilderLuc Pattyn6-Mar-08 9:16 
GeneralRe: Updating Winforms and multi-threading Pin
Jergosh6-Mar-08 9:24
Jergosh6-Mar-08 9:24 
GeneralRe: Updating Winforms and multi-threading Pin
Luc Pattyn6-Mar-08 9:33
sitebuilderLuc Pattyn6-Mar-08 9:33 
Generalgzip library Pin
damianrda6-Mar-08 7:39
damianrda6-Mar-08 7:39 
GeneralRe: gzip library Pin
Not Active6-Mar-08 8:03
mentorNot Active6-Mar-08 8:03 
QuestionInterop Access Violation Pin
Member 45984256-Mar-08 7:27
Member 45984256-Mar-08 7:27 
I'm having a problem using an unmanaged library from C#. The C++ sample app uses the following

<br />
typedef struct {<br />
  char *filename; //pointer to file name <br />
  char **paddr;   //double pointer to memory address of data<br />
  long *pbytes;   //pointer to the number of bytes of data in memory.  The length of paddr<br />
  long *pbuflen;  //pointer to the number of bytes allocated. Can be allocated to zero<br />
} MEMIOSTRUCT;<br />
<br />
extern "C" { __declspec (dllimport) int WINAPI OUTRun(LPSTR, MEMIOSTRUCT **); }<br />


Okay now my C# app uses the following
<br />
<br />
/// <summary>Memory File Structure</summary><br />
        [StructLayout(LayoutKind.Sequential)]<br />
        public struct MEMIOSTRUCT<br />
        {<br />
            /// <summary>Directory\File name</summary><br />
            public string filename;<br />
<br />
            /// <summary>Data replacement</summary><br />
            public string data;<br />
<br />
            /// <summary>Size of the data replacement</summary><br />
            public int dataSize;<br />
<br />
            /// <summary>Number of bytes allocated in memory</summary><br />
            public int bufferSize;<br />
        }<br />
<br />
[DllImport(@"owrm32c.dll", CallingConvention = CallingConvention.Winapi)]<br />
[return: MarshalAs(UnmanagedType.I4)]<br />
private static extern int OUTRun ( [MarshalAs(UnmanagedType.LPStr)] string s , [Out] MEMIOSTRUCT [ ] m );<br />
...<br />
MEMIOSTRUCT [ ] memioAlias = MemoryAliases.ToArray( ); // MemoryAliases is a List<memiostruct><br />
int exitCode = OUTRun(command , memioAlias);<br />
</memiostruct>


When I run this I get a AccessViolationException. How am I implementing this wrong? BTW, I'm not a C++ guy so don't flame me if this is simple.

Thanks,
Dan
QuestionHow do I determine the end-of-file in a spreadsheet/excel application Pin
Walaza6-Mar-08 6:15
Walaza6-Mar-08 6:15 
AnswerRe: How do I determine the end-of-file in a spreadsheet/excel application Pin
Jimmanuel6-Mar-08 7:30
Jimmanuel6-Mar-08 7:30 
GeneralRe: How do I determine the end-of-file in a spreadsheet/excel application Pin
Walaza6-Mar-08 19:47
Walaza6-Mar-08 19:47 
GeneralRe: How do I determine the end-of-file in a spreadsheet/excel application Pin
Jimmanuel7-Mar-08 2:52
Jimmanuel7-Mar-08 2:52 
GeneralAssociate File Extension with Internet Explorer Pin
Brad Wick6-Mar-08 6:12
Brad Wick6-Mar-08 6:12 
GeneralRe: Associate File Extension with Internet Explorer Pin
Not Active6-Mar-08 8:00
mentorNot Active6-Mar-08 8:00 
GeneralOpening a form inside other form Pin
NewToAspDotNet6-Mar-08 6:07
NewToAspDotNet6-Mar-08 6:07 
GeneralRe: Opening a form inside other form Pin
#realJSOP6-Mar-08 6:09
professional#realJSOP6-Mar-08 6:09 
GeneralRe: Opening a form inside other form Pin
NewToAspDotNet6-Mar-08 6:53
NewToAspDotNet6-Mar-08 6:53 
GeneralRe: Opening a form inside other form Pin
Dan Neely6-Mar-08 7:02
Dan Neely6-Mar-08 7:02 
GeneralRe: Opening a form inside other form Pin
Anthony Mushrow6-Mar-08 7:08
professionalAnthony Mushrow6-Mar-08 7:08 
GeneralRe: Opening a form inside other form Pin
Luc Pattyn6-Mar-08 7:30
sitebuilderLuc Pattyn6-Mar-08 7:30 
GeneralRe: Opening a form inside other form Pin
darkelv6-Mar-08 15:49
darkelv6-Mar-08 15:49 
GeneralWindows Service Question Pin
#realJSOP6-Mar-08 5:57
professional#realJSOP6-Mar-08 5:57 
GeneralRe: Windows Service Question Pin
Ernest Laurentin6-Mar-08 6:31
Ernest Laurentin6-Mar-08 6:31 
GeneralRe: Windows Service Question Pin
#realJSOP6-Mar-08 7:20
professional#realJSOP6-Mar-08 7:20 
GeneralRe: Windows Service Question Pin
Ernest Laurentin6-Mar-08 7:26
Ernest Laurentin6-Mar-08 7:26 

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.