Re: Calling D function from C

2010-10-11 Thread Daniel Worthington
Linking with the phobos lib got it to compile, but I get a Bus Error when running: EXC_BAD_ACCESS (SIGBUS). Playing with the code a bit and looking at the crash reports, it looks like this happens whenever the D code tries to allocate memory. Do you think this is an issue of using dmd and gcc toge

Calling D function from C

2010-10-11 Thread Daniel Worthington
I'm trying to set up a project where I can call D functions from C code. Based on the documentation ( http://www.digitalmars.com/d/2.0/interfaceToC.html) it looks like I should be able to do the following: dee.d: - - - - - - - - import std.stdio; extern(C) { void sayHelloFromD() {

Calling ShellExecute to open a URL in the default browser

2010-08-04 Thread Daniel Worthington
I am trying to compile the following code using: dmd test.d or dmd test.d shell32.lib import std.c.windows.windows; int main(string[] args) { extern (Windows) HINSTANCE ShellExecuteW(HWND, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, INT); HINSTANCE i = ShellExecuteW(null, "open", "http://www