Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
MissingmethodException in C#SmartDevice project Can't find Pinvoke DLL.

Answered MissingmethodException in C#SmartDevice project Can't find Pinvoke DLL.

  • Thursday, January 07, 2010 7:36 AM
     
     
    Hi,
        I am getting this error. when i am importing a dll from c++ appliaction.

    in my C# code i am importing this dll like this

     [DllImport("Assemble.dll", EntryPoint = "Settpdu")]
          static extern void Settpdu(byte[] VALUE);
    in my C++ code i am exporting this function like this
    extern "C" __declspec(dllexport)  void Settpdu(BYTE * VALUE);


    but once i am running this i am getting exception like.

    if any one please help me? what is the problem?


All Replies

  • Thursday, January 07, 2010 9:38 AM
     
     

    Did you make sure the native DLL is deployed to the target device? Also, you need to be aware of the fact that DllImport expects the DLL either to exist in the current path, or you need to specify a fully qualified path.

  • Thursday, January 07, 2010 10:52 AM
     
     Answered

    Hi dudepans,

    Please find the same discussion in thread below :


    http://social.msdn.microsoft.com/Forums/en/windowsmobiledev/thread/3fb84992-13a3-4d05-9072-280c1d7f8787


    Hope this may helpful..


    Thanks, Mohsin Shaikh. If you find my post is helpful for you then mark it as answer.
    • Proposed As Answer by Mohsin S Thursday, January 07, 2010 10:53 AM
    • Marked As Answer by ZHE ZHAO Wednesday, January 13, 2010 4:45 AM
    •  
  • Friday, January 08, 2010 9:24 AM
     
     
    Hi ,

        i try the depndency tool to test my Aseemble.dll.

    i am getting following error do you have any idea about this, following are the information.

    1.Error: At least one required implicit or forwarded dependency was not found.
    2.Error: Modules with different CPU types were found.

    If you can able to help me on this that will be great.


  • Friday, January 08, 2010 9:24 AM
     
     
    Hi ,

        i try the depndency tool to test my Aseemble.dll.

    i am getting following error do you have any idea about this, following are the information.

    1.Error: At least one required implicit or forwarded dependency was not found.
    2.Error: Modules with different CPU types were found.

    If you can able to help me on this that will be great.

  • Monday, January 11, 2010 6:07 AM
     
     Answered
    Hi,

    I've never used the "dependency tool". But the errors sound like your dll was not compiled towards the same platform as your target platform.

    Hope this helps,
    Zhe Zhao
    • Marked As Answer by ZHE ZHAO Wednesday, January 13, 2010 4:45 AM
    •  
  • Tuesday, January 12, 2010 2:22 AM
     
     
    Hi ZHE ZHAO,

                        I have very common question. first time i am working on C# projects,Can we use a dll implemented in C++ in to my C# project.

    Using a Pinvoke?

    Regards
    Pravi 
  • Tuesday, January 12, 2010 3:44 AM
     
     
    Yes, we can.
    For more detail about Pinvoke please refer to
    An Introduction to P/Invoke and Marshaling   
    Advanced P/Invoke   


    Hope this helps,
    Zhe Zhao