how to compile d programm with external c function
meldolion
pi at marsinvasion.de
Mon Feb 25 08:05:53 PST 2008
I tried to use this official page to solve a problem :
http://www.digitalmars.com/d/2.0/interfaceToC.html
The problem is there is nothing said about compiling this source.
I created a main.d and a helloworld.c sourcefile.
module main;
import std.string;
extern (C)
{
void printHelloWorld();
}
void main(){
printHelloWorld();
}
helloworld.c
#include <stdio.h>
void printHelloWorld(){
printf("hello world");
}
I created the object file for helloworld.c.
but when i call
bud_win_3.04.exe main.d helloworld.o
i get following error message.
OPTLINK (R) for Win32 Release 8.00.1
Copyright (C) Digital Mars 1989-2004 All rights reserved.
main.obj(main)
Error 42: Symbol Undefined _printHelloWorld
Does anyone knows the solution of this problem?
thx meldolion
More information about the Digitalmars-d-learn
mailing list