Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 900335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:22:13+00:00 2026-05-15T15:22:13+00:00

I have 2 unmanaged dlls which have exactly same set of function (but slightly

  • 0

I have 2 unmanaged dlls which have exactly same set of function (but slightly different logic).

How can I switch between these 2 ddls during runtime?

now I have:

[DllImport("one.dll")]
public static extern string _test_mdl(string s);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:22:14+00:00Added an answer on May 15, 2026 at 3:22 pm

    Expanding on the existing answers here. You comment that you don’t want to change existing code. You don’t have to do that.

    [DllImport("one.dll", EntryPoint = "_test_mdl")]
    public static extern string _test_mdl1(string s);
    
    [DllImport("two.dll", EntryPoint = "_test_mdl")]
    public static extern string _test_mdl2(string s);
    
    public static string _test_mdl(string s)
    {
        if (condition)
            return _test_mdl1(s);
        else
            return _test_mdl2(s);
    }
    

    You keep using _test_mdl in your existing code, and just place the if-statement in a new version of that method, calling the correct underlying method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a native/unmanaged DLL and it has a CreateObject function which returns a
I have an existing 32-bit ASP.NET application that used 32-bit unmanaged DLLs. If I
Hi all i have a background worker thread and some unmanaged code dlls ,
I have three projects 1)unmanaged c++ containing full business logic 2)C++/CLI ( Project name
I have an unmanaged (C/C++) DLL which I need to call from a C#
I have an unmanaged Win32 C++ application that uses multiple C++ DLLs. The DLLs
I have a unmanaged C++ dll for which I do not have access to
I have an unmanaged library which I want to use from a managed class.
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
I have a collection of unmanaged dlls with a C# wrapper around them that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.