How to efficiently call methods in DLL?

B

Brett

How to I call a method within a DLL every 1 minute? The DLL (written in
VB.NET) will download messages from a mail server and enter them into a
database. This application is a mixture of CFMX and VB.NET. Here are two
methods:

1. Allow the CFMX task scheduler to call a CF template, which then calls the
DLL as an object and references some method (s) within it.

2. Create a VB.NET EXE that references the DLL and use Windows Task
Scheduler.

3. ?

Which of the above is better and why?

Also, how do I initially load this DLL into memory so the any of the above
methods do not have to initiate the DLL every time they run? In other
words, if VB.NET is used, how does it retain a pointer to the object without
having to create one each time the scheduler runs and also avoid intiating
the object each time.

Thanks,
Brett
 
S

Samuel R. Neff

If you want to do it that often (every minute) then build the
scheduling into the dll itself. Have a thread that kicks off the
procedure every minute and sleeps the rest of the time.

Sam
 
B

Brett

Are you referring to the timer class?

How do I initially load the DLL to set everything in motion?

Thanks,
Brett
 
S

Samuel R. Neff

I wasn't referring to the Timer class but that certainly should work..
I was just referring to basic thread programming in .NET. But a Timer
would work fine as well.

The initiation depends on if you need the VB.NET process to
communicate back to CFMX or if it's just run and forget. If it's
run-once and forget, use an EXE and CFEXECUTE.

If you need to communicate back and forth you can either expose a COM
interface from the VB.NET app or use Gestaltech's Black Knight to
create a CFX tag.

http://www.gestaltech.com

One has to wonder why you're jumping through all these hoops
unnecessarily though. If you need to use VB.NET for part of your app,
why not do the whole thing in ASPX? If you need to do some part in
CFMX, then why not do the whole thing in CFML? Seems like the
services you're mixing can be easily accomplished in either language
and the mixing just adds a layer of complexity that isn't necessary.

My $0.02.

Sam
 
B

Brett

The program was originally in CFMX. However, VB.NET performs better in
certain areas. The program is structured in such a way that certain parts
run in complete isolation as little stand alone programs. They are very
small and rewritting them in VB.NET is very feasible.

Brett
 
S

Samuel R. Neff

Brett,

One other thing I completely forgot to mention is Blue Dragon. If you
really want to integrate .NET code with a CFMX page then take a look
at using New Atlanta's Blue Dragon server instead of Macromedia's. It
runs native .NET code and allows you to call .NET assemblies directly.
You can even use apsx controls within a CFMX page.

It's still in beta though, not sure when it will be released (been in
beta for at least a year and a half).

http://www.newatlanta.com/products/bluedragon

Best regards,

Sam
 
B

Brett

I know of Blue Dragon but some of the things I'm using with Macromedia
aren't support by Blue Dragon. I can comlpetely write certain sections in
VB.NET because they run in isolation. It's the better solution.

One other thing - CFMX will often peg the server at 100% cpu if it is doing
some processing such as reading a file, parsing it and inserting it into a
two dimensional array. The process is jrun.exe, which is the heart of CFMX.
Does .NET occassionally also do this (Pegging the cpu at 100%)? Some the
only way to stop it is to restart CFMX Server. Not good. All sessions,
application vars, database connections, etc. die at that point.

Thanks,
Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top