473,811 Members | 4,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Merging two DLL files

Is it possible to merge two DLL files into one? If so, how?

Thanx/NSP

Jun 18 '07 #1
10 10085
n o s p a m p l e a s e <no***********@ alum.comwrote:
Is it possible to merge two DLL files into one? If so, how?
Sure. Use fopen() one one file in binary append mode, fopen() on the
other file in binary read mode, and continue to fgetc() from the second
stream and fputc()ing the result into the first, until the result is
EOF. The result may not be what you expect; if you want something
Micro$oft-safe, ask in a Micro$oft-specific newsgroup.

Richard
Jun 18 '07 #2
n o s p a m p l e a s e said:
Is it possible to merge two DLL files into one?
Yes.
If so, how?
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
int rc = EXIT_FAILURE;
if(argc 3)
{
FILE *fpout = fopen(argv[1], "wb");
if(fpout != NULL)
{
FILE *fpa = fopen(argv[2], "rb");
if(fpa != NULL)
{
FILE *fpb = fopen(argv[3], "rb");
if(fpb != NULL)
{
int ch = 0;
while((ch = getc(fpa)) != EOF)
{
putc(ch, fpout);
}
while((ch = getc(fpb)) != EOF)
{
putc(ch, fpout);
}
if(!ferror(fpa) && !ferror(fpb) && !ferror(fpout))
{
rc = EXIT_SUCCESS;
}
fclose(fpb);
}
fclose(fpa);
}
if(fclose(fpout ))
{
rc = EXIT_FAILURE;
}
}
}
return rc;
}

That will do it, if I haven't made any mistakes.

As a bonus, it will merge any two files, not just DLLs.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 18 '07 #3
On Mon, 18 Jun 2007 04:33:17 -0700, in comp.lang.c , n o s p a m p l e
a s e <no***********@ alum.comwrote:
>Is it possible to merge two DLL files into one? If so, how?
DLLs are not part of the C language. Y ou need to ask the experts in a
Windows system group.

The answer by the way is likely to be the same as to the question "is
it possible to merge two EXE files into one?"
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jun 18 '07 #4
n o s p a m p l e a s e wrote:
Is it possible to merge two DLL files into one? If so, how?

Thanx/NSP
In each dll you have a different NAME space. If you merge
them, you will have to take care of the possible name
conflicts between them.

For instance if both dlls define a procedure called
"DoCalculations ()"
then you have to rename one of them into something else or else
the linker will fail.

Jun 18 '07 #5
On Mon, 18 Jun 2007 18:38:57 +0200, in comp.lang.c , jacob navia
<ja***@jacob.re mcomp.frwrote:
>n o s p a m p l e a s e wrote:
>Is it possible to merge two DLL files into one? If so, how?
In each dll you have a different NAME space. If you merge
them, you will have to take care of the possible name
conflicts between them.
I think this is going to be the least of his problems - how will you
merge two binary executables usefully?

to the OP: you need to be clearer about what you mean. If you want to
combine two actual DLL files into a single file, and you do not have
the source code from which they were built, you probably can't do it,
and its not a C problem anyway. If you mean you have hte source for
two DLLs, then Jacob's point is relevant and all you have to do is
resolve any overlap or conflicts between the source, then build a new
DLL (how you do this is again not a C question).
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jun 18 '07 #6
Mark McIntyre wrote:
On Mon, 18 Jun 2007 18:38:57 +0200, in comp.lang.c , jacob navia
<ja***@jacob.re mcomp.frwrote:
>n o s p a m p l e a s e wrote:
>>Is it possible to merge two DLL files into one? If so, how?
In each dll you have a different NAME space. If you merge
them, you will have to take care of the possible name
conflicts between them.

I think this is going to be the least of his problems - how will you
merge two binary executables usefully?
Actually... I never even thought about that possibility. Rereading
the question maybe the OP means literally merging the dlls like
the AVI files, that can be merged by just catenating them one
after the other...

In that case... he should first learn something :-)

Jun 18 '07 #7
In article <jh************ *************** *****@4ax.com>,
Mark McIntyre <ma**********@s pamcop.netwrote :
>On Mon, 18 Jun 2007 04:33:17 -0700, in comp.lang.c , n o s p a m p l e
a s e <no***********@ alum.comwrote:
>>Is it possible to merge two DLL files into one? If so, how?
>DLLs are not part of the C language. Y ou need to ask the experts in a
Windows system group.
Very true.
>The answer by the way is likely to be the same as to the question "is
it possible to merge two EXE files into one?"
I believe that Windows DLLs and Unix shared objects (e.g., DSOs)
have symbol tables, and that access to the objects (data, functions)
within them are mediated by the symbol table accesses (though possibly
only for the first call, with some systems patching the code to make the
call direct instead of through the mediation code).

These leads us to the possibility of having several DLLs or shared
objects that one wishes to combine into a single object (less to
distribute for example), with the symbol table layer being merged
so that the calling code still only has to know the symbol name and
the appropriate section of the combined object is accessed.

This is, I would say, considerably more plausible, in theory, than
merging two arbitrary EXE (executable) files into one, since executable
files might no longer have symbol tables (other than references to
unresolved symbols that are found in DLLs/shared objects).

I don't have any idea how -practical- this would be for DLLs;
I have, in my readings, occasionally encountered shared object mergers
for various Unices.
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
Jun 18 '07 #8

"jacob navia" <ja***@jacob.re mcomp.frwrote in message
news:46******** *************** @news.orange.fr ...
Mark McIntyre wrote:
>On Mon, 18 Jun 2007 18:38:57 +0200, in comp.lang.c , jacob navia
<ja***@jacob.r emcomp.frwrote:
>>n o s p a m p l e a s e wrote:
Is it possible to merge two DLL files into one? If so, how?

In each dll you have a different NAME space. If you merge
them, you will have to take care of the possible name
conflicts between them.

I think this is going to be the least of his problems - how will you
merge two binary executables usefully?

Actually... I never even thought about that possibility. Rereading
the question maybe the OP means literally merging the dlls like
the AVI files, that can be merged by just catenating them one
after the other...

In that case... he should first learn something :-)
Jacob, you often make incorrect comments abouts Windows
programming. Why do you even attempt to make them, when
you know the correct thing to do is direct them to a Windows
newsgroup?
Jun 19 '07 #9
Barry wrote:
>
Jacob, you often make incorrect comments abouts Windows
programming. Why do you even attempt to make them, when
you know the correct thing to do is direct them to a Windows
newsgroup?
???? What incorrect comments?

Maybe my introduction to windows programming in the tutorial
of lcc-win32 is incorrect somewhere?

I am not a "guru" and I can be wrong but I have been doing
windows/dos programming since 1991.
Jun 19 '07 #10

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

Similar topics

5
4557
by: Stefan Franke | last post by:
Hi, I would like to merge two XML files. The first XML contains a list of books, the second XML file contains a bestseller list of books. So some of the books in the first file will appear in the second file. I want to merge the two files, so that the ones, that also exist in the second XML file are printed in bold. I am trying to compare the titles of the books, but this doesn't seem to work. Could anybody give me a hint how to solve...
2
3594
by: Cy Huckaba | last post by:
I have an XML document that is linked to other document and I can't figure out what the best way to try and merge them before query qith an XpathNavigator. Simple example...a root xml document contains the root folder that can contain items and other folders. The other folders can either live in the root document or be in other xml files completely (to make it easier for multiple developers/processes to work on the data at the same time.) ...
3
11023
by: Mike | last post by:
Hi! I also asked this question in C# group with no results: I have 2 datasets loaded with data from two xml files having the same schema. The files contain data from yesterday and today. I'd like to merge both datasets in such a way that the resulting dataset should have all the today's data overriding yestrerday's data. CATCH: the today's dataset contains only the daily changes (DELTA) and merging should not remove all unchanged...
2
3897
by: Nikhil Prashar | last post by:
I'm trying to merge two XML files that have the same structure but not necessarily the same nodes in the same order. I've tried opening the files as datasets and using the DataSet.Merge() function, but this only "fumbles" the data together and puts children under the wrong parent nodes. How else could I go about merging the files? I'm using C# .NET.
0
1518
by: steve | last post by:
Hi there, I am trying to import data from 2 dbf files into excel using the 'get external data' option which launches ms query. Ultimately I am merging data with a right join statement. I can successfully select the dbf files, and drag the common ID fields to make a match, yet when trying to select the right join option, the left and right options are both greyed out and cannot be selected. If I type in the SQL manually, it works...
0
1378
by: Mike | last post by:
Hi! I have 2 datasets loaded with data from two xml files having the same schema. The files contain data from yesterday and today. I'd like to merge both datasets in such a way that the resulting dataset should have all the today's data overriding yestrerday's data. As you may guess, the today's dataset contains only the daily changes and merging should not remove all unchanged records. What's the most efficient way of doing so ? I...
1
2401
by: adamrace | last post by:
Hi, I've got two excel files, one has a list of products and their current prices and they all have a product ID, I have another file with a list of price's that need updating. I was wondering what the best way of going about merging the two files together, with the old price and the new price using the ID's. The second file has a list of all the products on their system, the first has just a few of these which are on the other system. If...
0
1352
by: veer | last post by:
Hello sir. I am making a program on merging in Visual Basic. The program is that I have a folder which is not on my hard drive contain 80 Mdb files and each Mdb file contains two tables. I want to merge all the Mdb files into a new Mdb file using a single execution or in one loop. I have some coding, please correct it or modify. I don't know how to move from one database to another. Set dbparent = Workspaces(0).OpenDatabase(txtparentMDBFile)...
0
2356
by: Albert-jan Roskam | last post by:
Hi John, Thanks! Using a higher xlrd version did the trick! Regarding your other remarks: -yep, input files with multiple sheets don't work yet. I kinda repressed that ;-) Spss outputs only single-sheet xls files, but I agree it's nicer if the programs works in other cases too. -and no, I don't intend to use data fields. Wouldn't it be easier to convert those to string values if I ever came across them? Thanks again! Albert-Jan
0
9724
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7665
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4336
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 we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.