[rdnzl-devel] Generic types and default thread apartment
Edi Weitz
edi at agharta.de
Thu Sep 14 17:18:29 UTC 2006
On Thu, 14 Sep 2006 11:09:11 +0200, "Goffioul Michael" <goffioul at imec.be> wrote:
> I had a look and you don't event need a patch :-) Generic objects
> can be created on the fly by specifying the parameter type between
> brackets, like:
>
> (new "System.Collections.Generic.List`1[System.String]")
>
> If you have 2 type parameters, then use "2" instead of "1" and
> separate types with a comma.
Ah, good... :)
> Of course, RDNZL could provide a wrapper API to make the syntax
> simpler, but it's not mandatory.
Yeah, I'll keep that in mind for a future release.
> I'm not an expert neither, but I think this is related to Interop
> and COM. In Single-Thread-Apartment (STA), all COM messages are
> processed in the same thread, while in Multi-Thread-Apartment (MTA,
> the default in .NET if you don't specify anything) COM objects can
> be accessed by multiple concurrent threads. In GUI, even in
> multithread application, the GUI (message loop) must run in a single
> thread, I guess that's why STA is preferable in Windows Forms
> application (In Visual Studio 2005, when you use the wizard to start
> a GUI application, it set the threading model to STA by default).
>
> Now about the effects, I think that some .NET components are simply
> based on existing COM components (which is hidden to the user). At
> least I had problems with common dialogs: the directory dialog and
> the file dialog. When using MTA, the directory selection dialog
> does not show the directory tree, and the file dialog does not list
> items correctly (for instance, "My Computer" is empty, or the dialog
> does not update itself when you change the filter).
>
> Try this (tried with .NET 2):
>
> (rdnzl:enable-rdnzl-syntax)
> (rdnzl:import-types "System.Windows.Forms" "FolderBrowserDialog")
> (setq dlg (rdnzl:new "System.Windows.Forms.FolderBrowserDialog"))
> [ShowDialog dlg]
>
> This problem was the cause that made me recompile RDNZL-cpp under
> VS2005. If you look into StdAfx.cpp, you'll see how I changed the
> apartment state, but I don't know if it would work under
> VC.NET-2003.
So, do I understand correctly that you already experienced these
problems with the DLL compiled with VS2003?
Thanks,
Edi.
More information about the rdnzl-devel
mailing list