Click here to Skip to main content
15,913,089 members
Home / Discussions / C#
   

C#

 
QuestionHow to Use C# realize the graphic website map? [modified] Pin
Member 472830111-Jan-08 1:29
Member 472830111-Jan-08 1:29 
AnswerRe: How to realizing the website mapeer? Pin
Pete O'Hanlon11-Jan-08 1:36
mvePete O'Hanlon11-Jan-08 1:36 
GeneralRe: How to realizing the website mapeer? Pin
Member 472830111-Jan-08 5:02
Member 472830111-Jan-08 5:02 
GeneralRe: How to realizing the website mapeer? Pin
led mike11-Jan-08 5:03
led mike11-Jan-08 5:03 
GeneralRe: How to realizing the website mapeer? Pin
Member 472830111-Jan-08 5:15
Member 472830111-Jan-08 5:15 
GeneralRe: How to realizing the website mapeer? Pin
Pete O'Hanlon11-Jan-08 23:04
mvePete O'Hanlon11-Jan-08 23:04 
AnswerRe: How to Use C# realize the graphic website map? Pin
Dan Neely11-Jan-08 5:30
Dan Neely11-Jan-08 5:30 
QuestionManaged/Unmanaged code - AccessViolationException Pin
Alex Zluka11-Jan-08 1:13
Alex Zluka11-Jan-08 1:13 
Hello All,

just few month ago started to program in C#. It's a great world there!
But I have quite some code written in C/C++, which I want to re-use in my C# development.

In C I have a function exported from a DLL. The function is declared as

EXPORT int my_foo(my_type **Devices, int *nrDevs);<br />
// where EXPORT is __declspec(dllexport)

That library is compiled with calling convention Cdecl

I need to call that function in my C# code.
I do the following...
<br />
// all the old great stuff goes here<br />
internal static class MyGreatFunctions<br />
{<br />
    [DllImport("my_good_old_stuff.dll", CallingConvention = CallingConvention.Cdecl)]<br />
    internal static extern int my_foo(ref IntPtr pDevs, ref int nDevs);<br />
}<br />
<br />
public class MyClass<br />
{<br />
    public MyClass()<br />
    {<br />
        int nDevs = 0;<br />
        IntPtr pDevs = IntPtr.Zero;<br />
        int r = MyGreatFunctions.my_foo(ref pDevs, ref nDevs);<br />
}


When my_foo is called I got AccessViolationException "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

The other functions (with no double pointers) are called fine. What do I miss here? Why do I get this AccessViolationException? Please! Help!! Cry | :((

PS
It's WinXP Pro Sp2
.NET 2.0
GeneralRe: Managed/Unmanaged code - AccessViolationException Pin
m@u11-Jan-08 1:40
m@u11-Jan-08 1:40 
GeneralRe: Managed/Unmanaged code - AccessViolationException Pin
Alex Zluka11-Jan-08 2:31
Alex Zluka11-Jan-08 2:31 
GeneralRe: Managed/Unmanaged code - AccessViolationException Pin
m@u11-Jan-08 2:49
m@u11-Jan-08 2:49 
GeneralRe: Managed/Unmanaged code - AccessViolationException Pin
Andre Azevedo18-Jan-08 5:13
Andre Azevedo18-Jan-08 5:13 
GeneralRe: Managed/Unmanaged code - AccessViolationException Pin
Alex Zluka22-Jan-08 13:42
Alex Zluka22-Jan-08 13:42 
GeneralProblem in window Service Pin
Waqas Badar11-Jan-08 1:01
Waqas Badar11-Jan-08 1:01 
GeneralRe: Problem in window Service Pin
Justin Perez11-Jan-08 2:29
Justin Perez11-Jan-08 2:29 
Questionhow to log keystroke through windows Service? Pin
Somnath Sen11-Jan-08 0:52
Somnath Sen11-Jan-08 0:52 
AnswerRe: how to log keystroke through windows Service? Pin
Dave Kreskowiak11-Jan-08 1:41
mveDave Kreskowiak11-Jan-08 1:41 
GeneralRe: how to log keystroke through windows Service? Pin
Somnath Sen11-Jan-08 1:59
Somnath Sen11-Jan-08 1:59 
GeneralRe: how to log keystroke through windows Service? Pin
Justin Perez11-Jan-08 2:31
Justin Perez11-Jan-08 2:31 
GeneralRe: how to log keystroke through windows Service? Pin
Pete O'Hanlon11-Jan-08 3:28
mvePete O'Hanlon11-Jan-08 3:28 
GeneralRe: how to log keystroke through windows Service? Pin
Dave Kreskowiak11-Jan-08 4:01
mveDave Kreskowiak11-Jan-08 4:01 
Questionstack issue Pin
Goncalo Oliveira11-Jan-08 0:29
Goncalo Oliveira11-Jan-08 0:29 
GeneralRe: stack issue Pin
Dave Kreskowiak11-Jan-08 4:07
mveDave Kreskowiak11-Jan-08 4:07 
GeneralRe: stack issue Pin
Goncalo Oliveira11-Jan-08 4:21
Goncalo Oliveira11-Jan-08 4:21 
GeneralRe: stack issue Pin
Dave Kreskowiak11-Jan-08 4:38
mveDave Kreskowiak11-Jan-08 4:38 

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.