Richard Saam <rdsaam@[EMAIL PROTECTED]
> wrote in message
news:<41517513.60804@[EMAIL PROTECTED]
>...
> Dr. Rolf Jansen:
>
> Along with Ann, could you help me on this problem?
>
> I have enstalled the free pascal (FPC 1.9.5) with xcode and Xcode
> Integration Kit with OS 10.3.
>
> The following program compiles nicely, but my purpose is to compile a
> pascal program written under IDE 3.1 Metrowerks.
I am not familiar with the Metrowerks IDE and the features of
different versions.
The current version of the Metrowerks IDE is > 8, isnīt it? So, I
assume that 3.1
is pretty old and it was not designed to build Carbon applications. It
might be even
possible that the Pascal compiler is 68k only.
Therefore your Pascal code has to undergo some transformations:
1. if your Metrowerks Pascal compiler is 68k, then some changes
concerning procedure pointers need to be made to your code.
This affects all sorts of callback routines. The procedure pointers
need to be transferred to universal procedure pointers. If you
never used procedure pointers, then possibly nothing has to be
done here.
2. Apple changed several routine names. For example DisposHandle
is now DisposeHandle. You can download a list of names that
changed from here:
ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/Interfaces/NewRoutineNames.sit.hqx
If you have MPW from Apple installed then you can use the Canon
tool to automate this process (read the do***entation before!)
3. In order to make your code run for Mac OS X you need to carbonize
it.
That means, you have to find out and remove or change all
deprecated
procedure or function calls from the old Mac OS Classic API to the
new
Carbon API. Apple provides a lot of do***entation and a tool called
CarbonDater to help on this step:
http://developer.apple.com/do***entation/Carbon/Conceptual/carbon_****ting_guide/cpg_intro_struct/chapter_1_section_1.html
If you decide to transform your code to Carbon then there is no better
way other than to read and understand that do***entation. For furter
reading start here:
http://developer.apple.com/referencelibrary/GettingStarted/GS_****ting/index.html
> The Pascal program
> uses many units which themselves refer to other units necessitating the
> "User Propagates" function in IDE 3.1 Metrowerks.
Uses propagation is currently not sup****ted in Free Pascal, although,
it might be sup****ted in the future. However, for Carbon development
it is no more of that im****tance than it was for Classic development.
Add only the unit Carbon to the uses clause of all your custom pascal
files.
All the other Mac OS units like QuickDraw, MacMemory, MacTypes ... are
included automatically into the Carbon unit. In fact, those units MUST
NOT
be specified separately in the uses clauses of your own code.
> In the following program, I inserted a typical unit "quickdraw" under
uses
> in addition to Carbon, TestUnit. An error occurred. It did not
compile.
This is normal, since QuickDraw is already included by Carbon, see
above.
> No particular message was given.
You can expand the Errors & Warnings Window. There is a button for
this
at the bottom of that window. Then you will see another pane which
contains all the messages which are emitted by the build system and
the compiler. If you scroll down to the bottom you probably find more
information why the compilation failed.
> What additional thing am I supposed to do to bring units into a program
> for subsequent compilation.
1. Add the unit files to the project. Then make sure that the unit
files
belong to the <<PROJECTNAME>>Units target. Unit Files MUST NOT
be part of the main program target. Please read:
http://developer.apple.com/do***entation/DeveloperTools/Conceptual/ToolsOvr_Book/index.html
2. refer to each particular unit in the appropriate uses clause. Free
Pascal
will care automatically which unit needs to be compiled at any
time.
Rolf


|