Is it possible to call D functions from C++

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 18 07:40:51 PDT 2015


On Wednesday, 18 March 2015 at 14:20:19 UTC, Benjamin Thaut wrote:
> On Wednesday, 18 March 2015 at 14:17:13 UTC, Namal wrote:
>> Hello, as in the title. How can I call D functions from C++ 
>> (If my main() is in a c++ file).
>>
>> Thanks alot!
>
> D:
>
> extern(C++) void SomeDFunction()
> {
>   doSomething();
> }
>
> C++:
>
> void SomeDFunction();
>
> void main()
> {
>   SomeDFunction();
> }
>
> Please also see:
> http://dlang.org/cpp_interface.html
>
> Kind Regards
> Benjamin


he probably will need cal rt_init and rt_term too.
similar post with example for C:

http://forum.dlang.org/post/ljgtqa$1qb1$1@digitalmars.com


More information about the Digitalmars-d mailing list