Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DDL Global Variables

Status
Not open for further replies.

scasystems

Programmer
Jan 15, 2003
44
GB
Hi All,
I have a standard library of functions which is in library.dll. I recently changed a logevent Routine to check a public global variable DEBUG_ON and exit if not set else write a logging event to a file.log.
The problem is my main program checks for /debug on the command line and then sets DEBUG_ON depending on the above.
However another DLL I have written which encapsulates logging on (shared by diffrent applications) doesn't write to the event.log while the main program does.

Is this to do with apartment threading. How can a library.dll have a public global variable that IS shared by all processes.

cheers for any help on this one
 
>>How can a library.dll have a public global variable that IS shared by all processes.

It can't, unless you dive into the shared memory stuff.


If you want to make anything public to other processes or other modules inside your process, you'll have to make a property out of it. This you can use to provide the global variable (which actual is only global inside the dll) to other process/dll's.

Greetings,
Rick
 
This does not work.
Library.DLL
Public Property Let/Get DEBUG_ON
Public SUB LogEvent(Message as String)
If not Debug_On then exit sub
...
... write to file
End Sub

System.DLL
LogEvent System Message

Main.frm
DEbug_ON = True
Logevent SomeMessage
call system subs

The upshot of which the logevent within the project outputs messages fine but any system.dll calls don't.

This says to me that the Project and the system dll use diferrent memory/threads????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top