Linking C and D
monarch_dodra
monarchdodra at gmail.com
Wed Feb 27 08:12:12 PST 2013
I'm trying to get the hello world of cross compiling working:
main.d
//----
extern (C) void foo();
void main()
{
foo();
}
//----
foo.c
//----
#include <stdio.h>
void foo()
{
printf("hello world");
}
//----
I can't seem to get the executable to link correctly.
I'm using gcc and dmd on windows.
I'm building foo.c with:
gcc -c foo.c -o foo.obj
Then I build my exe with:
dmd foo.obj main.d
But I get:
OPTLINK (R) for Win32 Release 8.00.12
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj Offset 00000H Record Type 004C
Error 138: Module or Dictionary corrupt
--- errorlevel 1
...Help ?
More information about the Digitalmars-d-learn
mailing list