Re: access the calling user's config info from a dll?

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Norman Yuan" <NotReal@xxxxxxxxxxx> wrote in message
news:%23Aj$QZCqGHA.3288@xxxxxxxxxxxxxxxxxxxxxxx
You should not read exe's app settings directly from inside dll's code.

DLL, by its nature, is code module that seperates from exe code with
consideration that it could be used by other exes (of course that are other
reasons to use dll).
If you do the app.cofg reading inside dll code, you physically tie the dll
with certain exe, the dll's reuseability is go partially or completely,
even different version of the same exe may break the dll.

Thanks for your help Norman.

As you say there are many reasons to use DLL's, and not all of them are
aimed at achieving reuse. I am trying to isolate my BO's from the
unnecessary risk that could be caused by all the minor expected changes to
the UI. Tying this dll to the exe isn't a great concern to me.

If I printed all the helptext associated with the new v2 user config
facilities (ApplicationSettingBase and ConfigurationManager classes and all
their members etc) I am sure that it would take more than a ream of paper.
It seems a deficiency to me that the new facilities don't allow for a dll to
easily access and update it's caller's config information. I did get
OpenMappedExeConfiguration method going, but can't get at the config
information in a type safe manner, and I got confused about permission and
locking considerations.

Again, I'd never read user/app config in dll. If you need to process
information from *.config in the dll code, you can always read them from
the calling exe app and pass the data itself to a dll object to process it
(and return back the changed data and save to *.config by the exe).

I implemented your suggestion re an interface class. I am quite pleased with
it, although my UI now has to include some complexity that I was hoping to
encapsulate into the BO dll. I guess that I will thank you if I ever reuse
the dll.

Thanks again for your help.
Barry Mossman


.



Relevant Pages

  • Re: Editors
    ... some strip them on exe files by default. ... "preferred base address" and, yup, relocations are completely ... DLL files, though, aren't loaded into their own address space but are ... EXE's "entry-point", though, is not "special" in that it's just an ...
    (alt.lang.asm)
  • Re: WSE 3.0 settings
    ... web.configs, they will take precedence over the parent config. ... The main exe will have to know ... I want to use third party DLL (Or I have to develop a DLL to be used in ... that DLL then I have to copy/paste all the settings from the third party ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: DLL pass vector by value crash
    ... The prototype for testfunc is a by-value copy, so it has to make a copy of the value. ... Are you using static linking for either the .exe (if so, it probably won't work correctly, ... clearly using the shared CRT DLL for the DLL you are constructing. ... no crash occurs in either config. ...
    (microsoft.public.vc.mfc)
  • Re: DLL pass vector by value crash
    ... stack of the exe and may allocate default member element on the exe heap. ... If this is a dangerous situation, the simple app I set up calling testFunc() ... in a dll did not crash. ... msvcr90.dll!free and access the source code of free.c. ...
    (microsoft.public.vc.mfc)
  • Re: Using same interfaces for in-proc vs. out-proc
    ... for each server) might work better after all. ... TLB,>you reference it in VB and gain access to all ... both EXE and DLL versions must use the same source code; ...
    (microsoft.public.vc.atl)