Thread overview
Problem linking in C code
May 15, 2007
akcom
May 16, 2007
torhu
Jun 12, 2007
Hoenir
Jun 12, 2007
Thomas Kuehne
May 15, 2007
I'm trying to link some C code into my D program.  I'm doing the following (using DMC to retain object file compatbility):

>dmc.exe aes.c aes.h -c
>lib
Digital Mars Librarian Version 8.00n
Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com
library file        (.lib) aes.lib
create new library (Y or N)? Y
action-object [-+*] (.obj) aes.obj
list file           (.lst)

Digital Mars Librarian complete.
>build aesc.d aes.lib
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

aes.lib
 Warning 140: Library probably needs FIXLIB
aesc.obj(aesc)
 Error 42: Symbol Undefined _aes_set_key

Any suggestions as to how to resolve the linking issue?

Regards,
Alex


May 16, 2007
akcom wrote:
> I'm trying to link some C code into my D program.  I'm doing the following (using DMC to retain object file compatbility):
> 
>>dmc.exe aes.c aes.h -c
>>lib
> Digital Mars Librarian Version 8.00n
> Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com
> library file        (.lib) aes.lib
> create new library (Y or N)? Y
> action-object [-+*] (.obj) aes.obj
> list file           (.lst)
> 
> Digital Mars Librarian complete.
>>build aesc.d aes.lib
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> 
> aes.lib
>  Warning 140: Library probably needs FIXLIB
> aesc.obj(aesc)
>  Error 42: Symbol Undefined _aes_set_key
> 
> Any suggestions as to how to resolve the linking issue?


I haven't used lib like that myself, but does it work if you link directly with the object file?  Instead of creating a .lib file first?
June 12, 2007
akcom schrieb:
> I'm trying to link some C code into my D program.  I'm doing the following (using DMC to retain object file compatbility):
> 
>> dmc.exe aes.c aes.h -c
>> lib
> Digital Mars Librarian Version 8.00n
> Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com
> library file        (.lib) aes.lib
> create new library (Y or N)? Y
> action-object [-+*] (.obj) aes.obj
> list file           (.lst)
> 
> Digital Mars Librarian complete.
>> build aesc.d aes.lib
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> 
> aes.lib
>  Warning 140: Library probably needs FIXLIB
> aesc.obj(aesc)
>  Error 42: Symbol Undefined _aes_set_key
> 
> Any suggestions as to how to resolve the linking issue?
> 
> Regards,
> Alex 
> 
> 
I'm interested in the solution of this problem as well.
June 12, 2007
Hoenir schrieb am 2007-06-12:
> akcom schrieb:
>> I'm trying to link some C code into my D program.  I'm doing the following (using DMC to retain object file compatbility):
>> 
>>> dmc.exe aes.c aes.h -c
>>> lib
>> Digital Mars Librarian Version 8.00n
>> Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com
>> library file        (.lib) aes.lib
>> create new library (Y or N)? Y
>> action-object [-+*] (.obj) aes.obj
>> list file           (.lst)
>> 
>> Digital Mars Librarian complete.
>>> build aesc.d aes.lib
>> OPTLINK (R) for Win32  Release 7.50B1
>> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>> 
>> aes.lib
>>  Warning 140: Library probably needs FIXLIB
>> aesc.obj(aesc)
>>  Error 42: Symbol Undefined _aes_set_key
>> 
>> Any suggestions as to how to resolve the linking issue?
>> 
>> Regards,
>> Alex
>> 
>> 
> I'm interested in the solution of this problem as well.

Can you post sample .c and .d files?

Thomas