December 10, 2009
"BCS" <none@anon.com> wrote in message news:a6268ffdff18cc46f7aa8b7a32@news.digitalmars.com...
> please tell me the subject is a freudian slip (or just a typo).
>
>

It's a very precise figure:

1 metric fuckton == 1,000 meteric shitloads


December 10, 2009
downs wrote:
> I've just committed a module to tools (tools.cpp, http://dsource.org/projects/scrapple/Trunk/tools/tools/cpp.d ) that should enable linking and using any C++ library with D programs without creating a C wrapper for it.
> 
> The code has been tested with a simple multiple-inheritance sample: http://paste.dprogramming.com/dpv8hpjp
> 
> The D code to bind to this is http://paste.dprogramming.com/dphlv1ot . It requires a symlink to the tools folder in its directory.
> 
> Caveats:
> 
>  - D1
>  - Only works on g++4's "newapi" layout and mangling (but should be reasonably portable).

At http://www.agner.org/optimize/, you can find a document (calling_conventions.pdf) which gives full details of the C++ name mangling schemes for various compilers.

> Writing this also gave us what I believe to be a fair contender to Most Horrifying Statement of D Ever Written:
> 
>   fndefs ~= `mixin("extern(C) `~t~` "~`~mname~`~"`~fnparams~`; ");`~'\n'~
>       `mixin("`~fn~`("~refToParamList("Params!(typeof(&"~`~mname~`~"))", isRef!(typeof(mixin("&"~`~mname~`))))~") {
>       return "~`~mname~`~"("~refToValueList(isRef!(typeof(mixin("&"~`~mname~`))))~");
>     }
>   "); `;

Ugh, that's unreadable.

I found that with a little function called string enquote(string s), which changes s into "s",  this kind of stuff looks much less terrible.
In particular you get rid of the nasty mix of ` and ".

fndefs ~= "mixin(" ~ enquote("extern(C)" ~ t ~ " ")
                   ~ "~" ~ mname
                   ~ "~" ~ enquote(fnparams ~ ";")
             ~ ");"
        ~ "mixin(" ~ ....

// etc
December 10, 2009
Hello downs,

> retard wrote:
> 
>> Thu, 10 Dec 2009 01:01:34 +0100, downs wrote:
>> 
>>> including such gems as incorrect
>>> tuple lengths, incorrect tuple slices, endless errors without line
>>> numbers, spurious template instantiation errors with nonsensical
>>> parameters, and at least one case where T[0] evaluated to T,
>>> necessitating the workaround Tuple!(T[0])[0], it felt appropriate.
>> Why are these needed? Because of compiler bugs?
>> 
> Apparently, in certain very specific corner cases, my version of GDC
> believes that when I say "T[0]", I really mean "T". In that case,
> "Tuple!(T[0])[0]" is like saying "really very the first element". :)
> 

I call it a Bug. Do you have a test case?


December 11, 2009
On 10/12/09 14:41, Nick Sabalausky wrote:
> "BCS"<none@anon.com>  wrote in message
> news:a6268ffdff18cc46f7aa8b7a32@news.digitalmars.com...
>> please tell me the subject is a freudian slip (or just a typo).
>>
>>
>
> It's a very precise figure:
>
> 1 metric fuckton == 1,000 meteric shitloads
>
>

Though I suppose in metric it would be a fucktonne. :D
December 11, 2009
downs wrote:
> I've just committed a module to tools that should enable linking and using any C++ library with D programs without creating a C wrapper for it.
> 


Does 'any' c++ library even include the ones in c++ namespaces? If so good job thanks.
December 12, 2009
Tim Matthews wrote:
> downs wrote:
>> I've just committed a module to tools that should enable linking and using any C++ library with D programs without creating a C wrapper for it.
>>
> 
> 
> Does 'any' c++ library even include the ones in c++ namespaces? If so good job thanks.

I don't know about namespaces, but that's a problem with mangling and thus, fixable. I'm currently wrestling with bullet physics, which doesn't use namespaces, so this isn't priority right now :p
December 12, 2009
On Sat, 12 Dec 2009 15:25:53 +0300, downs <default_357-line@yahoo.de> wrote:

> Tim Matthews wrote:
>> downs wrote:
>>> I've just committed a module to tools that should enable linking and
>>> using any C++ library with D programs without creating a C wrapper for
>>> it.
>>>
>>
>>
>> Does 'any' c++ library even include the ones in c++ namespaces? If so
>> good job thanks.
>
> I don't know about namespaces, but that's a problem with mangling and thus, fixable. I'm currently wrestling with bullet physics, which doesn't use namespaces, so this isn't priority right now :p

What's the wrapper performance penalty (if any)?

And can the code be a bit sanitized? As it is, I believe it is impossible to maintain by anyone except the original author, which is a bad thing.
December 13, 2009
Hello Denis,

> On Sat, 12 Dec 2009 15:25:53 +0300, downs <default_357-line@yahoo.de>
> wrote:
> 
>> Tim Matthews wrote:
>> 
>>> downs wrote:
>>> 
>>>> I've just committed a module to tools that should enable linking
>>>> and using any C++ library with D programs without creating a C
>>>> wrapper for it.
>>>> 
>>> Does 'any' c++ library even include the ones in c++ namespaces? If
>>> so good job thanks.
>>> 
>> I don't know about namespaces, but that's a problem with mangling and
>> thus, fixable. I'm currently wrestling with bullet physics, which
>> doesn't use namespaces, so this isn't priority right now :p
>> 
> And can the code be a bit sanitized? As it is, I believe it is
> impossible  to maintain by anyone except the original author, which is
> a bad thing.
> 

Given he works with bullet physics, I'd say being the only one who understands it qualifies as a "Bad Thing".


1 2
Next ›   Last »