Eyvind,
You must build it as a COM EXE not a DLL. Take a look at this:
define class demo as session olepublic
procedure init
if type("gcData") <> "C"
public gcData, gnCntr
gcData = ""
gnCntr = 0
endif
gnCntr = gnCntr + 1
endproc
procedure destroy
gnCntr = gnCntr - 1
endproc
function GetCurrentCounter
return(gnCntr)
endfunc
procedure Set(tcNewValue)
gcData = m.tcNewValue
endproc
function Get
return(m.gcData)
endfunc
enddefine
The trick is to declare the shared vars as public in the init (but only if they do not already exist.)
Also if you have more than 1 client that can update the vars you need some sort of synchronization to keep 2 clients from updating the variable at once.
HTH
>At last weeks devcon, I attended Nick Neklioudov's excellent session on building visual interfaces to COM objects, and I've been experimenting a bit on my own at home with this. However, there is one thing that I cannot get to work: How can I safely share a reference between several com objects residing on a server to another com object residing on the same server? I tried just using a public variable, and although I can access it from all of the objects, when I try to make further use of it, I get an OLE error saying something not very helpful like "Something went seriously wrong" (not exact, translated from Norwegian).
>
>Thank you in advance for any help.
>
>Eyvind