15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Application with Doc/View in DLL

alberto.gimenez@vlc.servicom.es
Wednesday, February 07, 1996

   I am writing a large quite application for a company.  The
application must cover, little by little, all management aspects of the
company:  customer's orders, orders to dealers, manufacture course,
delivery notes of sale, invoices, etc., etc.

   Given the size of the application have thought in implementing each
operation (invoices, etc.) in a Doc/View model and to include it in a
DLL.

I have the following doubt :
     - That it is the better form of designing the application?
     - I have to load all the DLL automatically (load-time dynamic
linking) and let that Windows95 is entrusted with memory gestion, or
well to load the DLL according to goes opening the documents and to
unload them upon closing them (run-time dynamic linking)?
     - How can be loaded dynamically DLLs with Doc/View in MCF 4.0?

   I wait anxiously you suggestions
   Thank you very much in advance.


--
Alberto Gimenez (alberto.gimenez@vlc.servicom.es)




Jim Lavin -- ooptech@Onramp.NET
Thursday, February 08, 1996

[Mini-digest: 3 responses]

At 07:03 PM 2/7/96 +0100, you wrote:
>   I am writing a large quite application for a company.  The
>application must cover, little by little, all management aspects of the
>company:  customer's orders, orders to dealers, manufacture course,
>delivery notes of sale, invoices, etc., etc.
>
>   Given the size of the application have thought in implementing each
>operation (invoices, etc.) in a Doc/View model and to include it in a
>DLL.
>
>I have the following doubt :
>     - That it is the better form of designing the application?
>     - I have to load all the DLL automatically (load-time dynamic
>linking) and let that Windows95 is entrusted with memory gestion, or
>well to load the DLL according to goes opening the documents and to
>unload them upon closing them (run-time dynamic linking)?
>     - How can be loaded dynamically DLLs with Doc/View in MCF 4.0?
>
>   I wait anxiously you suggestions
>   Thank you very much in advance.
>
>
>--
>Alberto Gimenez (alberto.gimenez@vlc.servicom.es)
>
>
>
You can easily accomplish Dynamic Loading of DLLs and exporting the classes
to your application at runtime.  The trouble comes with the creating and
deleting of the DocTemplates that manages each of the Doc/View combinations.
I haven't seen much code around that does this.  I would think that you
could do it dynamically, (shim, shim here. shim, shim there), All you would
need to do is create a new DocTemplateClass add it to the Application's list
of DocTemplates and then call OpenDocument().  When your done with the
doc/view you could then walk the list of DocTemplates and remove the ones
which do not currently have active documents.  But If the application
supports OLE Embedding and Linking you'd have to do a lot of work to catch
the requests to create the OLE objects in the COleObjectFactory
implementation.  It sounds like alot of work to just to avoid having a few
extra doc/view templates loaded into memory especially under a Win32
operating system.  If you're under Win16 give it up on any large size
project that contains more than 10 or more doc/view combinations.  You lose
up to 8% of system resources with each Doc/View combination you have.
Making your application a very big memory and resource HOG!  If your menu
structure is very similar between the different views you might try OCXs or
even In-Place Activated OLE objects that can be loaded dynamically at
run-time.  Both of these options keeps the functional code size managable
and keeps system resource usage low when a doc/view combination is not in use.

Good Luck!!!

Jim Lavin
OOP Technologies
http://emporium.turnpike.net/~jlavin
http://rampages.onramp.net/~ooptech

I've seen programmers who couldn't be passed by reference or by value!

-----From: Glenn Tesla Jayaputera 

Have a look at DLLHUSK example that comes w/ VC++
I think it has some kind of similar thing that you would like to do

cheer
gtj

-----From: Niels Ull Jacobsen 

Be sure to read the article on using databases with doc/view. When
handling databases, you have to think about what constitutes a
"document".

It may also be a good idea *not* to use the MDI interface (in case you
were intending to do so). Perhaps you should look at the "Workbook"
interface.  I think Stingray software has some MFC classes to support
this.
 
I haven't any experience in loading/unloading MFC DLL's dynamically.
I expect it's not trivial, especially when they're to be deeply 
interlinked with the app/doc view structure.

But I don't think you should use statically loaded DLL's. As far as I
understand Win32, the program pages are swapped into memory as they
are needed. This means that there are only three advantages to using
statically loaded DLL's instead of putting all the code in the
application:

1. Different applications can share the same DLL, thus reducing disk
consumption and memory usage if they're running at the same time.  If
you're only going to use your DLL's in one application, this doesn't
matter.

2. When distributing bug-fixes, you'll only have to ship the changed DLL's.
Take care of version checking.

3. You may be able to cut down on you link time during development.

Compared to the hassles and pitfalls, I don't think it's worth the trouble.


> --
> Alberto Gimenez (alberto.gimenez@vlc.servicom.es)



--
Niels Ull Jacobsen, Kruger A/S

Everything stated herein is THE OFFICIAL POLICY of the entire Kruger
group and should be taken as legally binding in every respect. Pigs
will grow wings and fly.



Mike Blaszczak -- mikeblas@msn.com
Monday, February 12, 1996

 
> I haven't any experience in loading/unloading MFC DLL's dynamically.
> I expect it's not trivial, especially when they're to be deeply 
> interlinked with the app/doc view structure.

It _is_ pretty trivial; it's documented in Tech Note 33.

.B ekiM
TCHAR szDisc[] = _T("Bored, bored, bored.");




| Вернуться в корень Архива |