How to take a function from an object file and make it a lib?

Started by ThoughtCriminal, January 08, 2006, 09:39:04 PM

Previous topic - Next topic

P1

Just add it to a lib, then run a lib to inc utilities, then use it.

Creating a new object library
You must create the library before you can use it. You can't create an empty library, so you need to add a module to it when you create it.

In this example, we'll create the object library my.lib and store the object module a.obj in it.

LIB /out:my.lib a.obj


Simple, no?

Adding or updating a module in an existing object library
Now that we've created the library, it's trivial to update it. Let's add our object module b.obj to my.lib:

LIB my.lib b.obj

Adding or updating a module in an existing object library
Now that we've created the library, it's trivial to update it. Let's add our object module b.obj to my.lib:

LIB my.lib b.obj


If b.obj was already present in my.lib, this will replace the original b.obj with the new one.

The rest of the commands are about as simple, but they're rarely used.



Regards,  P1  :8)


ThoughtCriminal

But how can I put just the function in.  I did that and it has everything present in the obj.  Like the program entry point.

Or perhaps I should me asking is there a way to remove what does not belong?


Thanks.

P1

Provided you have legal right to do so:

Google for a obj to asm, disassembler.  There were enough of them, when I was optimizing compiled basic code.

Cut & Paste for the functions you want and re-assemble.  This should be easy, seeing to you want to just trim out the bulk of the other functions.

Regards,  P1  :8)