linking in linux

llee llee at goucher.edu
Thu Sep 27 21:14:26 PDT 2007


I'm having problems calling functions that are defined in other .d files under linux.
Whenever I make a function call to a function that is defined in another .d file, the linker (ld) returns an error (exit code 1) saying that the referenced function is undefined.
I have a program that is trying to call a function named distorm_decode (...). This function is declared in the file distorm.d. The function is defined in a file named distorm.c. This file was compiled using the gcc compiler and stored in a .a archive (library) using ar. When I try to compile my program ld returns the following error:

d_disassembler.d:(.gnu.linkonce.t_Dmain + 0x10c): undefined reference to 'distorm_decode'
collect2: ld returned 1 exit status
--errorlevel 1

This is not the first time that I've encountered this problem. Other programs have also failed to compile, even when the function is defined in another d module. 

Any help would be appreciated.



More information about the Digitalmars-d mailing list