Welcome, Guest. Please login or register.

Author Topic: Compiling C Source code (smbfs) with SAS/C 6.58  (Read 5078 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Orphan264Topic starter

Compiling C Source code (smbfs) with SAS/C 6.58
« on: November 16, 2018, 01:44:45 AM »
I am hoping someone can lend some help to this lost soul. I am trying to become familiar with C programming on the Amiga. I have written some simple code and compiled it without problems.

I wanted to go a step further so I set up the source code for a program I have been using (smbfs) and I am trying to compile the project. I am using SAS/C 6.58 freshly installed on an Amiga 4000/40 with Workbench 3.1.4. I believe I have followed the instructions provided in the smakefile which mention copying over netinclde from roadshow. Here is what I get when I type SMAKE:

extern struct Library * DOSBase;
smbfs.h 100 Error 72: conflict with previous declaration
                      See line 4 file "include:proto/dos.h"

I gather from the error that the smbfs.h file is declaring something previously declared in dos.h. How do I resolve this problem? Is there some setting in sas/c that I have not changed but should have? Everything is default to the way it was installed.

I am looking for some guidance so I may better understand how the compilation process works and normal expectations of Amiga developers using the software.

Any insights appreciated.

- signed "Software Genius, NOT!"
 

guest11527

  • Guest
Re: Compiling C Source code (smbfs) with SAS/C 6.58
« Reply #1 on: November 16, 2018, 06:12:28 AM »
You either remove the double definition, or you define it correctly. The proper type of DOSBase is "struct DosLibrary *", not "struct Library *".
 

Offline Orphan264Topic starter

Re: Compiling C Source code (smbfs) with SAS/C 6.58
« Reply #2 on: November 19, 2018, 02:53:28 PM »
Thank you Thomas!

I initially took the approach of modifing the source code to remove the double definition, but this created more problems. Then I modified the "proto/dos.h" code by commenting out line 4 and that allowed me to compile successfully.

I suppose my question now is: Is there a compiler setting/flag/switch I should have used to prevent the build process from looking at my "proto/dos.h" file? (I managed to figure out how to change the smakefile so I could add NODEBUG.) I get the feeling I should not have touched my "proto/dos.h" file, at least until I know what I am doing.
 

guest11527

  • Guest
Re: Compiling C Source code (smbfs) with SAS/C 6.58
« Reply #3 on: November 19, 2018, 03:56:33 PM »
I initially took the approach of modifing the source code to remove the double definition, but this created more problems.
Then, I afraid, without knowing the other problems, the only thing I can state that you need to address the other problems as well. It is really as stated, "DOSBase" is a "DosLibrary *", but this implies that you have to cast, for example, the return code of OpenLibrary() or the parameter of CloseLibrary() to convert it from or back to the proper type, just to mention two other sources of potential compiler warnings.

Then I modified the "proto/dos.h" code by commenting out line 4 and that allowed me to compile successfully.
Outch. Don't do that. proto/dos.h is a system header, and editing it means that you break every other program that includes it.

If you *do not* want the system header to define "DOSBase", you need another set of headers. For that, you need to replace
Code: [Select]
#include <proto/dos.h>
by the following pair of includes:
Code: [Select]
#include <clib/dos_protos.h>
#include <clib/dos_pragmas.h>
if my memory serves me correctly. If you check "proto/dos.h", you will find that it will only include the above two files, and in addition declares DOSBase.

Note that in such a case, your code should in general declare DOSBase itself. How exactly does then not matter.
 
The following users thanked this post: Orphan264