473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How To Manage Library Functions


I have set up a number of frequently used functions in separate
classes in a folder called 'Jlib'. Each class is in its own file all
with the Namespace 'Jlib'.

To avoid duplication they often refer to other classes in the same
folder, i.e. my file functions are in a class called JGFF in their own
file. However some of the JGFF functions rely on, say, a DLL prototype
whose definition is in a class called JGAPI which is in its own file.

This all works fine in testing but when used in an app I have to set
up a link to both JGFF and JGAPI. Ideally I would like to just set up
a link to JGFF and have that automatically find/refer to JGAPI.

The solutions I have come up with are:
build all the functions into a DLL and use that - it works but it is
quite a large DLL.
put all the classes in to one file - I guess that would work but it
would be unwieldy.
Make each class self contained - but that leads to lots of
duplication.

Does anybody have any other suggestions/thoughts on a layout/structure
that would only require one reference in an app?

--
Jeff Gaines Damerham Hampshire UK

Nov 15 '05 #1
2 2922
Jeff,

The only way I can think to get around this would be to use a class
factory pattern of some sort. Basically, you would have a class in the one
referenced assembly which would create the instances of the classes for you.

On top of that, you would have to create interface definitions/base type
definitions all in that one assembly. These would be needed so you can cast
the objects returned from the class factory.

Because of this, the assembly referenced would have to load the
implementations dynamically, and not set a reference (because you can not
have circular references).

It can be done, but would require a lot of work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeff Gaines" <je**@jgaines.co.uk> wrote in message
news:p5********************************@4ax.com...

I have set up a number of frequently used functions in separate
classes in a folder called 'Jlib'. Each class is in its own file all
with the Namespace 'Jlib'.

To avoid duplication they often refer to other classes in the same
folder, i.e. my file functions are in a class called JGFF in their own
file. However some of the JGFF functions rely on, say, a DLL prototype
whose definition is in a class called JGAPI which is in its own file.

This all works fine in testing but when used in an app I have to set
up a link to both JGFF and JGAPI. Ideally I would like to just set up
a link to JGFF and have that automatically find/refer to JGAPI.

The solutions I have come up with are:
build all the functions into a DLL and use that - it works but it is
quite a large DLL.
put all the classes in to one file - I guess that would work but it
would be unwieldy.
Make each class self contained - but that leads to lots of
duplication.

Does anybody have any other suggestions/thoughts on a layout/structure
that would only require one reference in an app?

--
Jeff Gaines Damerham Hampshire UK

Nov 15 '05 #2
On Tue, 21 Oct 2003 09:32:12 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.com> wrote:
Jeff,

The only way I can think to get around this would be to use a class
factory pattern of some sort. Basically, you would have a class in the one
referenced assembly which would create the instances of the classes for you.

On top of that, you would have to create interface definitions/base type
definitions all in that one assembly. These would be needed so you can cast
the objects returned from the class factory.

Because of this, the assembly referenced would have to load the
implementations dynamically, and not set a reference (because you can not
have circular references).

It can be done, but would require a lot of work.

Hope this helps.


Nicholas

Many thanks for that, I think it's probably a bit complex for home
use, a pity we don't have '#include' or Delphi's 'uses' :-))

I've gone the DLL route for now. It was 'only' 75k and by including it
in all my apps I have immediate access to all my frequently used
functions.

Thanks again.
--
Jeff Gaines Damerham Hampshire UK

Nov 15 '05 #3

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

Similar topics

25
by: JeffS | last post by:
Honest, I scoured the comp.lang.c.faq for this but found nothing. :) Is there a library function for placing the cursor position in the console? Or is it something that can only be done with a...
19
by: Deniz Bahar | last post by:
Hi, I would like to call one of my functions the exact name as an existing C library function (for example K&R2 exercises asks me to make an atof function). If I don't include the header with...
50
by: Romeo Colacitti | last post by:
Is the C library of most OSes (i.e, unix type OSes) implemented at the very low kernel or just outside kernel level? Looking through the source tree of Linux/BSDs it seems like the C library is...
1
by: Miguel | last post by:
Hi... I need to manage entries in Microsoft DNS Server from C#, basically i need to add zones and hosts, and delete or modify previously inserted entries. I have been reading and guess that...
1
by: JohnH. | last post by:
Hi, Is there a better (best practice) way to do this? I have developed a large set of ASP.NET applications in C#. Like most applications I have a set of utility pages that can be called by...
4
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
1
by: Jarsinio | last post by:
I have some doubts about how managed exception in a VB.net aplication. In my aplicattion I have 3 clases: One clase is the UI ( Windows Forms). This class call a second clase who perform an...
20
by: J de Boyne Pollard | last post by:
MThe library functions which are included to allow process Mlaunch, forking, and termination, imply that it is both Mpossible and desirable for a process to fork itself. This is Ma fundamental...
16
by: Xiaoxiao | last post by:
Hi, I got a C library, is there a way to view the public function names in this library so that I can use in my C program? Thanks.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...

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.