November 23, 2005
Lionello Lunesu wrote:
> 
> I guess if only the stuff D _really_ needs to be in Phobos, meaning the GC and AA stuff. And one can use the CRT for IO, although it doesn't really show D's strengths.

I don't understand that first phrase: it's not well constructed, and I can't deduce the intended meaning.
-- 
Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
November 24, 2005
"Bruno Medeiros" <daiphoenixNO@SPAMlycos.com> wrote in message news:dm2s0c$2066$1@digitaldaemon.com...
> Lionello Lunesu wrote:
>>
>> I guess if only the stuff D _really_ needs to be in Phobos, meaning the GC and AA stuff. And one can use the CRT for IO, although it doesn't really show D's strengths.
>
> I don't understand that first phrase: it's not well constructed, and I can't deduce the intended meaning.

You're right, it's missing some words.. I have a hard time myself trying to remember what I wanted to say:
>> I guess only the stuff that D _really_ needs should be in Phobos, being the GC and AA stuff.
You can add to this the critical section calls.

L.


November 24, 2005
"Sean Kelly" <sean@f4.ca> wrote in message news:dm29c5$1fhs$1@digitaldaemon.com...
> It is my hope that even if Ares never really makes it, the three library structure it uses will be applied to Phobos.

Let's hope so. Thanks for the explanation.

L.


November 24, 2005
John C wrote:
> "Georg Wrede" <georg.wrede@nospam.org> wrote
> 
> You can host the runtime via COM, but it's barely documented and like squeezing water from a stone. 

LOL, how true. And brittle, IMHO.

Yes, I really could use a library (be it C or D) that I just link with, and then get to use .NET APIs.

But I guess writing such a library would be a huge project for anyone?
November 24, 2005
"Georg Wrede" <georg.wrede@nospam.org> wrote in message news:4385B76C.8060809@nospam.org...
> John C wrote:
>> "Georg Wrede" <georg.wrede@nospam.org> wrote
>>
>> You can host the runtime via COM, but it's barely documented and like squeezing water from a stone.
>
> LOL, how true. And brittle, IMHO.
>
> Yes, I really could use a library (be it C or D) that I just link with, and then get to use .NET APIs.
>
> But I guess writing such a library would be a huge project for anyone?

Fairly huge, yes, and it wouldn't be pretty. And apart from the actual interfaces that host the CLR, most of the API isn't exposed. For example, the COM representation of the String class has no methods. Here it is:

    interface _String : IDispatch {}

That's it. You have to call IDispatch.GetIDsOfNames(...) and IDispatch.Invoke(...) to do anything useful.

Only COM experts and sadists need apply.


November 24, 2005
I got from  http://staff.develop.com/jasonw/clr/readme.htm :



struct __declspec(uuid("6a33391c-fe7d-36e6-83b6-8b926ab94dc2"))

_String : IDispatch

{

//

// Raw methods provided by interface

//

virtual HRESULT __stdcall get_ToString (

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Equals (

VARIANT obj,

VARIANT_BOOL * pRetVal ) = 0;

virtual HRESULT __stdcall GetHashCode (

long * pRetVal ) = 0;

virtual HRESULT __stdcall GetType (

struct _Type * * pRetVal ) = 0;

virtual HRESULT __stdcall CompareTo (

VARIANT Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall Clone (

VARIANT * pRetVal ) = 0;

virtual HRESULT __stdcall GetTypeCode (

enum TypeCode * pRetVal ) = 0;

virtual HRESULT __stdcall ToBoolean (

VARIANT_BOOL * pRetVal ) = 0;

virtual HRESULT __stdcall ToChar (

unsigned short * pRetVal ) = 0;

virtual HRESULT __stdcall ToSByte (

char * pRetVal ) = 0;

virtual HRESULT __stdcall ToByte (

unsigned char * pRetVal ) = 0;

virtual HRESULT __stdcall ToInt16 (

short * pRetVal ) = 0;

virtual HRESULT __stdcall ToUInt16 (

unsigned short * pRetVal ) = 0;

virtual HRESULT __stdcall ToInt32 (

long * pRetVal ) = 0;

virtual HRESULT __stdcall ToUInt32 (

unsigned long * pRetVal ) = 0;

virtual HRESULT __stdcall ToInt64 (

__int64 * pRetVal ) = 0;

virtual HRESULT __stdcall ToUInt64 (

unsigned __int64 * pRetVal ) = 0;

virtual HRESULT __stdcall ToSingle (

float * pRetVal ) = 0;

virtual HRESULT __stdcall ToDouble (

double * pRetVal ) = 0;

virtual HRESULT __stdcall ToDecimal (

DECIMAL * pRetVal ) = 0;

virtual HRESULT __stdcall ToDateTime (

DATE * pRetVal ) = 0;

virtual HRESULT __stdcall ToType (

struct _Type * type,

VARIANT * pRetVal ) = 0;

virtual HRESULT __stdcall Equals_2 (

BSTR Value,

VARIANT_BOOL * pRetVal ) = 0;

virtual HRESULT __stdcall get_chars (

long index,

unsigned short * pRetVal ) = 0;

virtual HRESULT __stdcall CopyTo (

long sourceIndex,

SAFEARRAY * destination,

long destinationIndex,

long Count ) = 0;

virtual HRESULT __stdcall ToCharArray (

SAFEARRAY * * pRetVal ) = 0;

virtual HRESULT __stdcall ToCharArray_2 (

long startIndex,

long Length,

SAFEARRAY * * pRetVal ) = 0;

virtual HRESULT __stdcall get_Length (

long * pRetVal ) = 0;

virtual HRESULT __stdcall Split (

SAFEARRAY * separator,

SAFEARRAY * * pRetVal ) = 0;

virtual HRESULT __stdcall Split_2 (

SAFEARRAY * separator,

long Count,

SAFEARRAY * * pRetVal ) = 0;

virtual HRESULT __stdcall Substring (

long startIndex,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Substring_2 (

long startIndex,

long Length,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Trim (

SAFEARRAY * trimChars,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall TrimStart (

SAFEARRAY * trimChars,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall TrimEnd (

SAFEARRAY * trimChars,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall CompareTo_2 (

BSTR strB,

long * pRetVal ) = 0;

virtual HRESULT __stdcall EndsWith (

BSTR Value,

VARIANT_BOOL * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf (

unsigned short Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_2 (

unsigned short Value,

long startIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_3 (

unsigned short Value,

long startIndex,

long endIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_4 (

SAFEARRAY * Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_5 (

SAFEARRAY * Value,

long startIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_6 (

SAFEARRAY * Value,

long startIndex,

long endIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_7 (

BSTR Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_8 (

BSTR Value,

long startIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall IndexOf_9 (

BSTR Value,

long startIndex,

long endIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf (

unsigned short Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_2 (

unsigned short Value,

long startIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_3 (

unsigned short Value,

long startIndex,

long endIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_4 (

SAFEARRAY * Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_5 (

SAFEARRAY * Value,

long startIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_6 (

SAFEARRAY * Value,

long startIndex,

long endIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_7 (

BSTR Value,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_8 (

BSTR Value,

long startIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall LastIndexOf_9 (

BSTR Value,

long startIndex,

long endIndex,

long * pRetVal ) = 0;

virtual HRESULT __stdcall PadLeft (

long totalWidth,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall PadLeft_2 (

long totalWidth,

unsigned short paddingChar,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall PadRight (

long totalWidth,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall PadRight_2 (

long totalWidth,

unsigned short paddingChar,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall StartsWith (

BSTR Value,

VARIANT_BOOL * pRetVal ) = 0;

virtual HRESULT __stdcall ToLower (

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall ToLower_2 (

struct _CultureInfo * culture,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall ToUpper (

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall ToUpper_2 (

struct _CultureInfo * culture,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Trim_2 (

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Insert (

long startIndex,

BSTR Value,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Replace (

unsigned short oldChar,

unsigned short newChar,

BSTR * pRetVal ) = 0;

virtual HRESULT __stdcall Remove (

long startIndex,

long Count,

BSTR * pRetVal ) = 0;

};


November 24, 2005
"Lionello Lunesu" <lio@remove.lunesu.com> wrote in message news:dm4ggf$bk4$1@digitaldaemon.com...
>I got from  http://staff.develop.com/jasonw/clr/readme.htm :
>
<snip>

Thanks for that. If only I knew it existed when I was tinkering with this stuff last year. I wonder why OleView omits those methods.


November 24, 2005
John (or anyone),

Am I mistaken, or can we use code similar to that .net moniker to interface D with .NET natively?

Seems we have to define all those interface (=converting the mscorlib.h) and we need some factory to obtain those interfaces from. We'd define the interfaces in D modules similar to the .NET namespaces. Then we need some classes for the exotic CLI types, like variant, bstr. But it seems very doable??

L.


November 24, 2005
Lionello Lunesu wrote:
> I got from  http://staff.develop.com/jasonw/clr/readme.htm :
> 
> struct __declspec(uuid("6a33391c-fe7d-36e6-83b6-8b926ab94dc2"))
> 
> _String : IDispatch
> 
> {

(snip)

Gee, thanks!

November 24, 2005
"Lionello Lunesu" <lio@remove.lunesu.com> wrote in message news:dm4m3h$hnc$1@digitaldaemon.com...
> John (or anyone),
>
> Am I mistaken, or can we use code similar to that .net moniker to interface D with .NET natively?

No, you're not mistaken.

>
> Seems we have to define all those interface (=converting the mscorlib.h) and we need some factory to obtain those interfaces from. We'd define the interfaces in D modules similar to the .NET namespaces. Then we need some classes for the exotic CLI types, like variant, bstr. But it seems very doable??
>
> L.
>

Indeed, it's very doable. To get started, you'll need a more complete COM module than that included in phobos (it doesn't define IDispatch or VARIANT; note that bstr is just an alias for "wchar_t*"). You use coclasses to create instances of those interfaces.

I'll post a complete example tomorrow. Although Mr Wrede might have beaten me to it by then.