Results 1 to 6 of 6

Thread: How do I manually load libraries?

  1. #1

    Thread Starter
    Lively Member hbandarra's Avatar
    Join Date
    Aug 2002
    Location
    Lisbon, PT
    Posts
    66

    How do I manually load libraries?

    I'm loading dlls using System.Reflection.Assembly.LoadFrom() for getting instances using System.Type.GetInterface() and System.Activator.CreateInstance().

    The thing is:
    What if that dll references to other dlls? How should I load those dlls into memory? Using System.Reflection.Assembly.LoadFrom() or REGSVR32.EXE? Is there any way to tell Windows that I have a folder where he should find the required dlls?

    Note that that folder is not and cannot be the system folder or the folder of the executable of the running application, i.e., I want to specify the path.

    Thanks!

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    that is the job of that dll.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Lively Member hbandarra's Avatar
    Join Date
    Aug 2002
    Location
    Lisbon, PT
    Posts
    66
    Humm... So I just need to call something like System.Reflection.Assembly.Load() before using an external method?

    But, if I'm a good boy and I want to help that assembly with its resources, can I load them for it before I even call it?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Humm... So I just need to call something like System.Reflection.Assembly.Load() before using an external method?
    You load the dll YOU need. That dll loads what it needs.

    But, if I'm a good boy and I want to help that assembly with its resources, can I load them for it before I even call it?
    But there is no reason to do that. Why make a dll that forces the app calling it to load up what it needs? That is just plain pointless and you are just making it more difficult to use than need be and provides 0 benefits and more work.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Lively Member hbandarra's Avatar
    Join Date
    Aug 2002
    Location
    Lisbon, PT
    Posts
    66
    OK. I'll detail my situation:

    I'm loading assemblies dynamically, as I said. Each of those assemblies is at a particular path with needed satellite assemblies.

    The problem is that the assemblies are not aware of that path and that path is not the same of the running application. Is it sufficient having satellite assemblies on the same path, or do I have to tell windows to go search there for assemblies?

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    I think what you need is the GAC(Global Assembly Cache). It is sort of like registering. I dont have much infop on it as I dont use it.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

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