none
problem trying to convert a C++ DLL header file into C# DllImport (const BYTE *) RRS feed

  • Question

  • Hello,

     

     I'm trying to convert this line from a header file to a C# program so it can access the DLL file and I'm getting some kind of type mismatch exception and I need some help on what the prototype means. It has to deal with the const BYTE* parameter in the following header file:

     

    Code Snippet

     

    int __declspec(dllexportTransmitByte_SER(int chanhandle, const BYTE* cChar);

     

    int __declspec(dllexportTransmitString_SER(int chanhandle, const BYTE* lpBuf, int dwCount);

     

     

    The BYTE I can work out pretty much on my own and don't have a problem with it, but why have a const in front of them? What's the significance to having that placed in there?

     

    Steve

     

    Tuesday, April 22, 2008 10:41 AM

Answers

  • It means the function will not change the content of the buffer (i.e. it's an input only parameter).

     

    Tuesday, April 22, 2008 10:49 AM
    Moderator

All replies

  • It means the function will not change the content of the buffer (i.e. it's an input only parameter).

     

    Tuesday, April 22, 2008 10:49 AM
    Moderator
  • Thanks Mattias, it was helpful. My team members and I didn't have a clue and thought we did something wrong. It turns out it's something hardware related.

     

    Tuesday, April 22, 2008 1:59 PM