Click here to Skip to main content
15,888,979 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

What is the best approach if I have a DLL and different machines with different configuration files use it? I believe issues may arise specially if some properties are not set in some of the configuration files in some machines.

For example:

MachineA's myDLL.dll uses mySimpleConfig.config below:

<configurations>
<xCoord> 0 </xCoord>
<yCoord> 0 </yCoord>
<color> brown </color>
</configurations>


MachineB's myDLL.dll uses myLackingConfig.config below:

<configurations>
<color> brown </color>
<background> white </background>
</configurations>

The "normal" properties of myDLL.dll are the ones set in MachineA. MachineB's config file lacks some of the properties needed and it also has properties not supported by myDLL.dll.

The solutions I have in mind so far are:
- make a tool that creates the .config file so all the machines using myDLL.dll will have the same contents. Disadvantage is it will take time to create the tool.
- just make default values for properties not set in the config file (the obvious one)

I searched on how to load DLL files based on different contents of config files but none of them seem to have the same situation as mine.

Any help will do. Links will be of great help.

Thanks. :)
Posted
Updated 9-Nov-11 1:22am
v2
Comments
Amir Mahfoozi 9-Nov-11 5:11am    
Your question is very ambiguous, so please describe what did you mean by saying configuration ? or properties ?
Please give an example.
Amir Mahfoozi 9-Nov-11 7:30am    
How does those configuration files are created ? By your program or another program ?
karylle 9-Nov-11 7:50am    
Hi Amir,

Thanks for the quick reply. it's made by another program. the current situation is if MachineB uses the dll, certain steps need to be done in MachineB for the dll to work correctly. i am trying to modify the DLL and the config file for it to get rid of the additional "steps" for the dll to work right in MachineB.

This is not the best way to approach your problem. The application using the DLL should set these properties by some initialisation call into the dll thus eliminating the need for any configuration file. A DLL should not be dependent on the machine it is being loaded on, but should be flexible enough to provide a subset of its features when necessary.
 
Share this answer
 
I think, as you said yourself, the quickest and easiest solution is having default values for properties which are not in the config file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900