March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to krzaq | On Wednesday, 18 March 2015 at 15:54:04 UTC, krzaq wrote:
> Oh, right. I'm sorry, I assumed void main() means D, since it's not legit C++.
C++ allows implementation-defined return type of main.
| |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Thursday, 19 March 2015 at 07:42:48 UTC, Kagamin wrote: > On Wednesday, 18 March 2015 at 15:54:04 UTC, krzaq wrote: >> Oh, right. I'm sorry, I assumed void main() means D, since it's not legit C++. > > C++ allows implementation-defined return type of main. I'm afraid that you've mistaken C++ for C. The C++ standard quite clearly says: > An implementation shall not predefine the main function. This function shall not be overloaded. **It shall have a return type of type int**, but otherwise its type is implementation-defined. | |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to krzaq | On Thursday, 19 March 2015 at 08:32:10 UTC, krzaq wrote:
> but otherwise its type is implementation-defined.
This.
| |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Thursday, 19 March 2015 at 08:33:07 UTC, Kagamin wrote:
> On Thursday, 19 March 2015 at 08:32:10 UTC, krzaq wrote:
>> but otherwise its type is implementation-defined.
>
> This.
I'm not sure what you're failing to understand here. It **shall* have the return type of int. The rest (as in: parameter list) is implementation defined.
| |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to krzaq | Hmm... I read it as "it shall have the return type of int, but if not, then it's implementation-defined". | |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Thursday, 19 March 2015 at 08:38:45 UTC, Kagamin wrote: > Hmm... I read it as "it shall have the return type of int, but if not, then it's implementation-defined". In that case, I refer you to https://www.ietf.org/rfc/rfc2119.txt | |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On Wednesday, 18 March 2015 at 15:52:33 UTC, Benjamin Thaut wrote:
> On Wednesday, 18 March 2015 at 14:50:21 UTC, Namal wrote:
>>
>> Can you help me show how to compile and link it together please, thank you.
>
> What platform are you on, windows, linux, osx? What c++ compiler do you use? msvc, clang, gcc?
Linux, gcc and dmd. In my case c++ refuses to compile
if main is void.
| |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Namal | On Thursday, 19 March 2015 at 11:47:37 UTC, Namal wrote:
> On Wednesday, 18 March 2015 at 15:52:33 UTC, Benjamin Thaut wrote:
>> On Wednesday, 18 March 2015 at 14:50:21 UTC, Namal wrote:
>>>
>>> Can you help me show how to compile and link it together please, thank you.
>>
>> What platform are you on, windows, linux, osx? What c++ compiler do you use? msvc, clang, gcc?
>
>
> Linux, gcc and dmd. In my case c++ refuses to compile
> if main is void.
well then change it to the full signature ;-)
| |||
March 19, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On 3/19/15 1:38 AM, Kagamin wrote:
> Hmm... I read it as "it shall have the return type of int, but if not,
> then it's implementation-defined".
"shall" is prescriptive in standardese, i.e. means "must". -- Andrei
| |||
March 20, 2015 Re: Is it possible to call D functions from C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to krzaq | On 2015-03-19 1:57 AM, krzaq wrote:
> On Thursday, 19 March 2015 at 08:38:45 UTC, Kagamin wrote:
>> Hmm... I read it as "it shall have the return type of int, but if not,
>> then it's implementation-defined".
>
> In that case, I refer you to https://www.ietf.org/rfc/rfc2119.txt
To be picky (because I live in RFCs)... RFC 2119 doesn't have anything to say about "shall". It does have something to say about "SHALL". The capitalization is important.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply