Click here to Skip to main content
15,666,286 members
Home / Discussions / C#
   

C#

 
GeneralRe: sql server express Pin
Henry Minute19-Jan-11 1:15
Henry Minute19-Jan-11 1:15 
AnswerRe: sql server express Pin
Steve Maier17-Jan-11 4:38
professionalSteve Maier17-Jan-11 4:38 
QuestionUser account rights Pin
marca29217-Jan-11 2:19
marca29217-Jan-11 2:19 
AnswerRe: User account rights Pin
_Erik_17-Jan-11 2:52
_Erik_17-Jan-11 2:52 
Questionadd data,delete data,modify data,save data from datagrid Pin
chaitravb17-Jan-11 1:21
chaitravb17-Jan-11 1:21 
AnswerRe: add data,delete data,modify data,save data from datagrid Pin
RaviRanjanKr17-Jan-11 1:35
professionalRaviRanjanKr17-Jan-11 1:35 
QuestionConverting Clipboard Outlook Data-Msg to C# object for use Pin
Ravi Sant17-Jan-11 1:07
Ravi Sant17-Jan-11 1:07 
QuestionExposing unsafe methods through an interface. PinPopular
thatdiceygirl16-Jan-11 23:47
thatdiceygirl16-Jan-11 23:47 
I am currently working on a project, which will dynamically load in a C++ library and instantiate one of the contained classes through the use of a common interface.

However, one of the methods that I am trying to expose in the C++ library takes the following set of arguments...

C++Library.MethodName(String^ stringVariable, unsigned char sProblemVariable[])


This is where the problem arises.

Now I know the C# equivalent of the unsigned char [] argument is a byte, so I am attempting to use this method in the following manner.

byte[] byteArr = new byte[127];

unsafe
{
   fixed (byte *bytePointer = byteArr)
   {
      int returnValue = Interface.MethodName(aStringVariable, bytePointer);
   }
}


So I am attempting to expose the C++Library.MethodName through the Interface, using the following method signature...

unsafe int MethodName(string stringVariable, byte *problemVariable);


When compiling the C++ Library, implementing the interface, it builds successfully so I assume that the C++ method signature satisfies the C# interface signature.

However, when I attempt to load the C++ Library, I get a Reflection Exception telling me there is no implementation for the MethodName method, in the Library.

Any help would be greatly appreciated!!

Thanks..
A girl in Engineering AND IT?!...what is this nonsense?

AnswerRe: Exposing unsafe methods through an interface. Pin
#realJSOP17-Jan-11 0:32
mva#realJSOP17-Jan-11 0:32 
GeneralRe: Exposing unsafe methods through an interface. Pin
thatdiceygirl17-Jan-11 3:51
thatdiceygirl17-Jan-11 3:51 
GeneralRe: Exposing unsafe methods through an interface. Pin
Pete O'Hanlon17-Jan-11 5:28
subeditorPete O'Hanlon17-Jan-11 5:28 
AnswerRe: Exposing unsafe methods through an interface. Pin
Pete O'Hanlon17-Jan-11 0:49
subeditorPete O'Hanlon17-Jan-11 0:49 
AnswerMessage Removed Pin
17-Jan-11 1:17
Ravi Sant17-Jan-11 1:17 
GeneralRe: Exposing unsafe methods through an interface. Pin
#realJSOP17-Jan-11 1:19
mva#realJSOP17-Jan-11 1:19 
GeneralRe: Exposing unsafe methods through an interface. Pin
Chris Maunder17-Jan-11 1:34
cofounderChris Maunder17-Jan-11 1:34 
GeneralRe: Exposing unsafe methods through an interface. Pin
#realJSOP17-Jan-11 2:08
mva#realJSOP17-Jan-11 2:08 
GeneralRe: Exposing unsafe methods through an interface. Pin
Ravi Sant17-Jan-11 3:09
Ravi Sant17-Jan-11 3:09 
AnswerRe: Exposing unsafe methods through an interface. Pin
PIEBALDconsult17-Jan-11 1:43
professionalPIEBALDconsult17-Jan-11 1:43 
AnswerRe: Exposing unsafe methods through an interface. Pin
_Erik_17-Jan-11 2:50
_Erik_17-Jan-11 2:50 
QuestionHow to do edit ,update and delete in DataGridview using C# Pin
GJBalaji16-Jan-11 19:05
GJBalaji16-Jan-11 19:05 
AnswerRe: How to do edit ,update and delete in DataGridview using C# Pin
Abhinav S16-Jan-11 20:02
Abhinav S16-Jan-11 20:02 
AnswerRe: How to do edit ,update and delete in DataGridview using C# Pin
Mycroft Holmes16-Jan-11 20:23
professionalMycroft Holmes16-Jan-11 20:23 
GeneralRe: How to do edit ,update and delete in DataGridview using C# Pin
OriginalGriff16-Jan-11 20:43
mvaOriginalGriff16-Jan-11 20:43 
AnswerRe: How to do edit ,update and delete in DataGridview using C# Pin
RaviRanjanKr16-Jan-11 22:49
professionalRaviRanjanKr16-Jan-11 22:49 
GeneralRe: How to do edit ,update and delete in DataGridview using C# Pin
Pete O'Hanlon16-Jan-11 22:57
subeditorPete O'Hanlon16-Jan-11 22:57 

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.