www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How to use a D object file from C?

reply Traveler Hauptman <Traveler_member pathlink.com> writes:
How do I access D functions and methods from a C program?
Sep 01 2005
parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"Traveler Hauptman" <Traveler_member pathlink.com> wrote in message 
news:df6teq$i0c$1 digitaldaemon.com...
 How do I access D functions and methods from a C program?

You declare functions as extern (C) and make a header file for your C code. You can't get access to methods since that would require the D object API to be available in C/C++ directly. I have a very alpha reflection API for C coders to find D classes, instantiate them and access methods and fields. It's available at http://home.comcast.net/~benhinkle/dflect/ ps- this thread might have been more appropriate for digitalmars.D.learn
Sep 01 2005