locked
Loading a Dll RRS feed

  • Question

  • Hey,

    I have created a Dll. I would like to be able to use the function in it. I know that I can load it by writing "using mydll" at the top, or by writing "[dllimport...". However, this means I have to hard code the name of the DLL into the program. I would like to be able to create a dll after the program has been compiled and have the program find the dll and use the function in it... This is because I want it to be east to add functionality to the software (for example allowing it to load different types of files).

    I think it has something to do with Assembler, but I don't really understand it... Any help would be much appreciated...

    Matt

    Tuesday, December 14, 2010 6:07 PM

Answers

All replies

    • Proposed as answer by Paul Zhou Thursday, December 16, 2010 6:53 AM
    • Unproposed as answer by Paul Zhou Friday, December 17, 2010 7:20 AM
    Tuesday, December 14, 2010 6:20 PM
    • Proposed as answer by Paul Zhou Thursday, December 16, 2010 8:50 AM
    • Marked as answer by Paul Zhou Monday, December 20, 2010 1:26 AM
    Tuesday, December 14, 2010 9:51 PM
  • Souds like you are creating viruses or spyware.  There is no practical use for something like this.

    Tuesday, December 14, 2010 10:32 PM
  • No, I don't.
    Tuesday, December 14, 2010 11:41 PM
  • Hi ,

    Welcome to MSDN Forum.

    According to your description of the problem, the issue you are experiencing is:

    1’ There is an available software, you need to add function to into it.

    2’ The function needs to load different types of files, which needs to load different DLLs to complete the action.

    If I have misunderstood anything, please feel free to let me know.

    As we know, JIT compiler will compile your source code to managed modules, then to assemblers. If we do like what you thought, the application needs to create DLL everytime you run it. I suggest that you can add a function which contains several methods. Every method completes a function to load a kind of files. One method loads one suitable DLL which has been compiled. What do you think of it?

    I hope this will help resolve your problem. If anything is unclear, please free feel to let us know. Thank you for your understanding and support.

    I look forward to hearing from you.

    Best regards,

    Paul Zhou


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Paul Zhou Thursday, December 16, 2010 8:12 AM
    Thursday, December 16, 2010 6:53 AM
  • I definately am not. I am offended by that. I am creating a project than needs to be very adaptable and be able to save/load files in multiple different formats and I want users to be able to add their own functionality.
    Thursday, December 16, 2010 10:02 AM
  • I think that is what I need. I just don't know how to do it... thanks :)
    Thursday, December 16, 2010 10:04 AM
  • Hi Codeeator,

    The link in Louis.fs’s reply will be useful for you, have you tried it? His APIFactory maybe makes your thought true.

     

    Best regards,

    Paul Zhou

     


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 17, 2010 8:30 AM