Dynamically redirect calls to different assembly?

Justin Lang

I've been asked to do something unusual at work. We have some clients which are using applications which make calls to our DLL (let's call it Sdk.dll).

Recently, someone decided to change some namespaces in the Sdk code. If we were to provide this new DLL to our clients, their applications would break.

However, some clients will be writing applications using the new version of the DLL (let's call it Sdk.Updated.dll).

My task is to somehow support both old and new client applications, without recompiling the client apps.

I thought that I could simply replace the old Sdk.dll with a new one, which redirects all the calls to the appropriate callee in Sdk.Updated.dll. However, it seems like it will be tedious to write wrapper classes for each instance where a namespace was changed.

I'm wondering if anyone might have suggestion for a more dynamic way to accomplish this?

So, just to be clear:

Client 1:

using Sdk;

// ...

int sum = new Calc().AddTwoNumbers(3, 4);

Client 2:

using Sdk.Updated;

// ...

int sum = new Calc().AddTwoNumbers(3, 4);

Sdk.Updated.dll:

namespace Sdk.Updated {
    public class Calc {
        public AddTwoNumbers(int x, int y) {
            return x + y;
        }
    }
}

What would be the best way to support both client applications, with the restriction that we can't recompile the client applications?

(As an added wrinkle, some method names may have been changed between Sdk and Sdk.Updated, but I'd rather just get an idea of how to handle the namespace thing first...)

Justin Lang

After some investigation (including using namespace aliases, and building a tool which uses reflection to dynamically generate wrapper DLLs), we have concluded that there is no good way to do this without recompiling the client applications.

In fact, the namespaces should not have been changed without first considering the potential impact on client apps. (I'm sure this will be obvious to anyone reading this.)

Hopefully this saves someone a lot of time (and money) if you are asked to do something similar.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to Dynamically Allocate Memory Using Assembly and System Calls Under Linux

From Dev

Redirect APIs calls from frontend to backend on different machines in Node

From Dev

Powershell config assembly redirect

From Dev

Dynamically loading Assembly

From Dev

Assembly Linux system calls vs assembly OS x system calls

From

Assembly Binding redirect: How and Why?

From Dev

Injecting into a different project/assembly

From Dev

How to redirect method calls in python?

From Dev

Redirect all calls to print to a file

From Dev

How to redirect API calls with nginx?

From Dev

How to obtain assembly name dynamically

From Dev

Dynamically load assembly from byte[]

From Java

What are the return values of system calls in Assembly?

From Dev

How to get Windows system calls assembly statically?

From Dev

Msvc Inline assembly inner function calls

From Dev

Redirect to a different domain with Mojolicious

From Dev

unable to redirect to different webpage

From Dev

Different redirect with GET parameter

From Dev

Htaccess redirect different domains

From Dev

Assembly mismatch despite having assembly redirect and loading correct version

From Dev

How to achieve assembly binding redirect in a plugin scenario?

From Dev

Assembly: Printing a line in Different Colors

From Dev

Order of assignment produces different assembly

From Dev

Load resource from different assembly

From Dev

Getting two different GUIDs for an Assembly

From Dev

Define a function on assembly in different compilers

From Dev

How can I dynamically reference an assembly that looks for another assembly?

From Dev

Different object dynamically in FlatList

From Dev

Redirect calls made to apache through a php

Related Related

HotTag

Archive