News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compiling Dll and Lib in BCC

Started by jpattee, August 12, 2005, 04:59:00 PM

Previous topic - Next topic

jpattee

I am using the borland compiler.  It compiles and links exe files OK.  It compiles dll and lib files OK but there is a problem with linking.

I have tried changing the registry entries but it has no effect.  CodeBlocks doesn't seem to be using the registry for these.

Linker message for the dll follows:

ilink32.exe    -L"C:\_jpFiles\Programs\CodeBlocks\Borland\BCC55\Lib" -L"C:\_jpFiles\Programs\CodeBlocks\Borland\BCC55\Lib\PSDK" -o "AStyle.dll"    obj\Astyle\src\ASCase.obj obj\Astyle\src\ASFormatter.obj obj\Astyle\src\ASResource.obj obj\Astyle\src\astyle_main.obj obj\Astyle\src\ASBeautifier.obj   
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Fatal: Unable to open file 'ASTYLE.DLL'
Process terminated with status 1 (0 minutes, 3 seconds)
1 errors, 34 warnings


Linker message for the static library follows.  The problem is the 'o' in 'obj'.  When I change this to something else, the unexpected char is always the first letter.

tlib.exe /C "lib\AStyle.lib" +obj\Astyle\src\ASCase.obj obj\Astyle\src\ASFormatter.obj obj\Astyle\src\ASResource.obj obj\Astyle\src\astyle_main.obj obj\Astyle\src\ASBeautifier.obj ,
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
Error: unexpected char 'o' in command line
Process terminated with status 1 (0 minutes, 2 seconds)
0 errors, 34 warnings


rickg22

OK um... define "using the registry". You got me confused in there.

jpattee

CodeBlocks has registry entries like "Link object files to static library" with a value of "$lib_linker /C $static_output +$link_objects,$def_output".  Changing these values didn't seem to change the command line.  For instance, I removed the + before "+$link_objects", but it was still there in the call to tlib.exe.

rickg22

I guess you don't know you can change these settings in "Advanced compiler settings", don't you?

jpattee

Thanks, I didn't know that.

So...
What do I change to eliminate the errors?

rickg22

Um... try linking those particular files by hand - what we need is the format of the commandline used to invoke the compiler (or in this case, the linker). Try running "ilink32 /?" which will display a series of options. The trick is to modify the commandline in the settings so that it matches the one used by ilink32.

lymichri

Quote from: jpattee on August 12, 2005, 04:59:00 PM
Linker message for the static library follows.  The problem is the 'o' in 'obj'.  When I change this to something else, the unexpected char is always the first letter.

tlib.exe /C "lib\AStyle.lib" +obj\Astyle\src\ASCase.obj obj\Astyle\src\ASFormatter.obj obj\Astyle\src\ASResource.obj obj\Astyle\src\astyle_main.obj obj\Astyle\src\ASBeautifier.obj ,
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
Error: unexpected char 'o' in command line
Process terminated with status 1 (0 minutes, 2 seconds)
0 errors, 34 warnings


For static linking change the template in "Advanced compiler settings" from

$lib_linker /C $static_output +$link_objects,$def_output

to

$lib_linker /C /P512 $static_output /a $link_objects.

The original definition doesn't work because the "+" has to be prepended for each object.
The optional /P512 option for the page size can be omitted, if you don't need it.

jpattee

Thanks to everyone for the response.

Something else has come up and it will probably be next week before I get back to this.  But I will try the fix to the static library the first chance I get.  I will post a reply of the results.

Meanwhile, if anyone knows a valid command line for linking a dll I would appreciate a response.  This is the first time I have worked with Borland and I am not familiar with the compiler and linker options.



jpattee

Here are the linker options that worked for me.

To link the static library, I changed the + to /a as per lymichri above.  It worked.  The settings I used for "Link object files to static library" are:

$lib_linker /C $static_output /a $link_objects,$def_output


A dynamic library uses the same link program as an executable, so the command line format has to be the same.  I modified the executable command line by adding -Tpd and changing c0w32 to c0d32.   The settings I used for "Link object files to dynamic library" are:

$linker -Tpd $link_options $libdirs c0d32 $link_objects, $exe_output,, $libs,, $link_resobjects