Commodore 128 Alive!

Commodore 128 => 128 programmers => C / Other => Topic started by: bacon on January 31, 2008, 05:15 PM

Title: Problem with link in Power C
Post by: bacon on January 31, 2008, 05:15 PM
I'm not a C programmer (although I know the absolute basics) but I thought I'd try some C programming on the 128, jus for fun. When following the instructions in the manual how to compile the test.c program on the Power C disk everything goes well until I run the link command. The computer locks up and the disk drive sits there spinning and reading (or writing, I don't know which) forever. In VICE I can see that the drive switches between track 18 and track 13 over and over. This happens with every copy of Power C I've found online and it happens on my real C128 + 1541-II drive, in VICE on my Linux box at home and on WinVICE at work (ahem...). Anyone else experiencing this problem?
Title: Re: Problem with link in Power C
Post by: hannenz on January 31, 2008, 07:32 PM
hmm... sounds really strange... at which stage of linking does this occur? when you link "test.o" ? or the libs (up-arrow) ? Do you give any options to the linker? It is known that the linker crashes if it is fed with an invalid object file, so it seems that the object file "test.o" must be corrupted in some way, so try recompiling it... please give detailed info on what you are typing in..., it should be something like:

[insert powerc-128-sys-disk]
> cc -n test.c
> [compiler output]
> link
> test.o
[insert powerc-128-lib-disk]
> ^
output filename: test
>


EDIT: I just tested with VICE/Linux and the disk image i uploaded at my hp (http://people.freenet.de/hannenz/powerc/powerc.html) and it works with the commands above: (http://people.freenet.de/hannenz/linktest.png)
Title: Re: Problem with link in Power C
Post by: bacon on January 31, 2008, 09:17 PM
I followed the instructions in the Power C manual (e-text from Project 64), which means I didn't pass any options to the compiler. It linked test.o as it should but it failed when linking the libs (up-arrow). I'll try it with the -n option.
Title: Re: Problem with link in Power C
Post by: bacon on January 31, 2008, 09:28 PM
Nope, didn't help. Maybe this version of Power C expects the libraries to be on the same disk as the object file (I'm using the D64 images with the libraries on a seperate disk)? I'll try it later with the version from your site.
Title: Re: Problem with link in Power C
Post by: hannenz on February 01, 2008, 01:53 AM
no, the libraries are always on an extra disk, that's not the problem, since if the linker doesn't find a special file from a lib, it issues
62, file not found, x, y
as i said, there must be a problem with one of the object files it tries to load. Please try linking "test.o" but then press RETURN alone, so that the linker prints out all missing modules, and post it here. One of them must be corrupted, thats the only possibility i can imagine; still being very strange since you say, you tested different disk images... can't imagine that they are all broken in the same way...???!
Title: Re: Problem with link in Power C
Post by: hannenz on February 01, 2008, 04:05 AM
Do you TRIM the object file??! If yes, try recompiling and DON'T trim it. I just recall that though i didn't experience any bugs when trimmimg obj files on the c64 version, i had many cases similar to your description, when trying to link a trimmed obj file on the 128er version of Power-C. I am nearly 100% sure now, that that's the problem!!!
Title: Re: Problem with link in Power C
Post by: bacon on February 01, 2008, 05:13 AM
Yes, as I said, I followed the instructions in the manual and it said there to trim. That must be it. Thanks!
EhPortal 1.34 © 2025, WebDev