Click here to Skip to main content
15,911,141 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Doubt in NGEN and CLR Pin
Captain See Sharp10-Oct-06 15:19
Captain See Sharp10-Oct-06 15:19 
QuestionInternet gateway Pin
Gleader18-Oct-06 20:57
Gleader18-Oct-06 20:57 
QuestionNative Exception Error: 0xc0000005 Pin
Mark C Eaton8-Oct-06 15:56
Mark C Eaton8-Oct-06 15:56 
AnswerRe: Native Exception Error: 0xc0000005 Pin
Luc Pattyn9-Oct-06 8:40
sitebuilderLuc Pattyn9-Oct-06 8:40 
GeneralRe: Native Exception Error: 0xc0000005 Pin
Mark C Eaton9-Oct-06 13:34
Mark C Eaton9-Oct-06 13:34 
AnswerRe: Native Exception Error: 0xc0000005 Pin
Luc Pattyn9-Oct-06 14:54
sitebuilderLuc Pattyn9-Oct-06 14:54 
GeneralRe: Native Exception Error: 0xc0000005 Pin
Mark C Eaton9-Oct-06 15:26
Mark C Eaton9-Oct-06 15:26 
GeneralRe: Native Exception Error: 0xc0000005 Pin
Luc Pattyn9-Oct-06 15:43
sitebuilderLuc Pattyn9-Oct-06 15:43 
Hi Mark,

when passing a managed object's pointer to unmanaged code, you better make sure the object
does not get moved around by the garbage collector while in use by unmanaged code.
The following code snippet illustrates this:

// pass a managed byte array to an unmanaged C/C++ function:
public int Read(byte[] data, int len) {
try {
// check boundaries (bad len would cause an exception !)
data[0]=0;
data[len-1]=0;
// pin the array in memory, get its base adr
GCHandle dataHandle=GCHandle.Alloc(data, GCHandleType.Pinned);
int dataPtr=dataHandle.AddrOfPinnedObject().ToInt32();
int result=nativeCall(dataPtr, len);
dataHandle.Free(); // release the pinned array
return result;
} catch (Exception exc) {...log.and.return.errorcode...}
}

The above is the design pattern I often use for passing arrays to unmanaged C code.

Best regards,

Luc Pattyn.

GeneralRe: Native Exception Error: 0xc0000005 Pin
Mark C Eaton9-Oct-06 15:56
Mark C Eaton9-Oct-06 15:56 
QuestionCan not create web applicaion Pin
nkjha17-Oct-06 3:03
nkjha17-Oct-06 3:03 
AnswerRe: Can not create web applicaion Pin
mr_lasseter8-Oct-06 11:29
mr_lasseter8-Oct-06 11:29 
QuestionWeird Biztalk 2006 exception Pin
WillemM6-Oct-06 2:43
WillemM6-Oct-06 2:43 
AnswerRe: Weird Biztalk 2006 exception Pin
WillemM6-Oct-06 3:28
WillemM6-Oct-06 3:28 
Questionwhat is GAC(Global Assembly Cache) and what is meant by digitally signing an assembly Pin
Mushtaque Nizamani6-Oct-06 0:53
Mushtaque Nizamani6-Oct-06 0:53 
AnswerRe: what is GAC(Global Assembly Cache) and what is meant by digitally signing an assembly Pin
Mike Dimmick6-Oct-06 5:27
Mike Dimmick6-Oct-06 5:27 
QuestionRDA Pull error 28037 Pin
rsgdba6-Oct-06 0:37
rsgdba6-Oct-06 0:37 
QuestionHow can i learn more about background of the .net framework 2.0 ? Pin
Yanshof5-Oct-06 9:22
Yanshof5-Oct-06 9:22 
AnswerRe: How can i learn more about background of the .net framework 2.0 ? Pin
Praveen Nayak5-Oct-06 17:36
Praveen Nayak5-Oct-06 17:36 
GeneralBeside something like this book - is there anything more\else ? Pin
Yanshof6-Oct-06 5:46
Yanshof6-Oct-06 5:46 
GeneralRe: Beside something like this book - is there anything more\else ? Pin
Kevin McFarlane7-Oct-06 5:26
Kevin McFarlane7-Oct-06 5:26 
Questionbug in XmlReader ? Pin
Chris Losinger5-Oct-06 5:59
professionalChris Losinger5-Oct-06 5:59 
AnswerRe: bug in XmlReader ? Pin
Guffa5-Oct-06 14:13
Guffa5-Oct-06 14:13 
GeneralRe: bug in XmlReader ? Pin
Chris Losinger5-Oct-06 15:00
professionalChris Losinger5-Oct-06 15:00 
AnswerRe: bug in XmlReader ? Pin
Guffa5-Oct-06 21:13
Guffa5-Oct-06 21:13 
GeneralRe: bug in XmlReader ? Pin
Chris Losinger6-Oct-06 1:46
professionalChris Losinger6-Oct-06 1:46 

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.