CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2014
    Posts
    3

    Passing an array to a DLL

    I'm having trouble figuring out how to pass an array (buffer) to a DLL. Currently I have the code taking in a list of a string of parameters for a command line call:

    m_processMethodInfo.Invoke(m_checkObject, list.ToArray<object[]>());

    Is there any way to pass in an array (buffer) to the Invoke() function? Or possibly add an array to the list already created?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Passing an array to a DLL

    Is the DLL a COM dll?

  3. #3
    Join Date
    Sep 2014
    Posts
    3

    Re: Passing an array to a DLL

    No it's not a COM object, it's a .net assembly.

    Is there a better way than using the invoke method?

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Passing an array to a DLL

    Quote Originally Posted by mson9 View Post
    No it's not a COM object, it's a .net assembly.

    Is there a better way than using the invoke method?
    Yes. Add a referenced to the assembly in the project where you wish to use the dll.

    And in the source code, create a class instance and call a method (the same as you would for a class that is directly in your project). You'll need to also add a using xxxnamespace; where you are using the code from the assembly.

  5. #5
    Join Date
    Sep 2014
    Posts
    3

    Re: Passing an array to a DLL

    Thanks, but I figured a way to do what I was trying to do.

    It's similar to the example code here:
    http://www.dotnetperls.com/getmethod <http://www.dotnetperls.com/getmethod>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured