473,503 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assembly emmition problem

Hi,

Introduction
********************
I am writing some kind pf an assembly linker, this linker should be able to
work with an already compiled assembly, e.g. add several global methods,
To achieve that I use the unmanaged reflection COM interface e.g. ICeeFileGen,
IMetaDataEmit, ...

The problem
********************
Taking in mind what was just said, I am using the ICeeFileGen 'object' to create an identical copy of an existing assembly:
1. use IMetaDataDispenserEx->OpenScope To open an existing assembly.
2. Get a IMetaDataEmit for that assembly
3. use ICeeFileGen->CreateCeeFile to create a new file
4. Configures output file ( e.g. name, ... )
5. ICeeFileGen->LinkCeeFile
6. call FileGen->EmitMetaDataEx(IMetaDataEmit)
7. Add some propriotay methods
8. call ICeeFileGen->LinkCeeFile again
9. FileGen->GenerateCeeFile
10.FileGen->DestroyCeeFile

When using 'ildasm.exe' on the new assembly generated I can see that the methods of the original assembly has no MSIL implementation, it seems that calling FileGen->EmitMetaDataEx(IMetaDataEmit) doesn't ‘link’ the MSIL code provided for the original assembly, to achieve MSIL code duplication I have to do the following:
1. Enumerate through the original
assembly methods
2. Get the RVA of each method
3. Allocate memory for the code
segment on the new Assembly
through the ICeeFileGen interface
4. Copy the MSIL code from the
source assembly to the destination
assembly.
5. Set the destination RVA in the
new assembly metadata.

(*) Is there any way to avoid the manual copying of MSIL described above? is it possible to copy the method MSIL in the same manner it's metadata is copied?

Any comments samples or pointers will be appreciated.

--
Nadav
http://www.ddevel.com
Nov 17 '05 #1
0 927

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3078
by: Paul Klanderud | last post by:
I'm having a problem with being unable to remove a reference to an old, nonexistent version of a strongly- named assembly. I should mention that my issues arose at the same time I upgraded from...
2
20611
by: Peter Gomis | last post by:
I have encountered a situation where I am unable to remove a .NET assembly from the GAC. The message I receive is "Assembly 'assemblyname' could not be uninstalled because it is required by other...
1
1495
by: Elad Volpin | last post by:
Hi, I have struggled for several hours with this issue until I've understood and solved my problem. However, my solution isn't necessarily an optimal one, and worse - I think that my...
0
1674
by: Ken Durden | last post by:
I'm working on a client-server application where the client is controlling two devices (aka servers) which both implement the same interface contract. We have a set of about 4 assemblies which...
2
1746
by: Andrew Jocelyn | last post by:
Hi I get this error when I change something in the web.config file. When I build the VS projects and load the first web page the application runs fine. If I then make a save the web.config file...
3
4384
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
1
2349
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
14
2642
by: Monty | last post by:
Hello, I have created a solution which has both a web UI and a winform UI, the latter is just for administrators. The Web UI (a Web Application Project) and the winform project both...
0
3927
by: Andy | last post by:
Thanks Peter, I thought I'd give an update on this problem. My application had 2 assemblies that contained classed for the Data access and business logic layer. It was on one of them that I was...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.