• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pascal/Delphi and XCode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pascal/Delphi and XCode


  • Subject: Re: Pascal/Delphi and XCode
  • From: Dave <email@hidden>
  • Date: Fri, 9 Feb 2007 15:34:50 +0000

Hi All,

Thanks Chris and Jonas. I did a lot of tweaking with Free Pascal and eventually got it to work!

One more thing though, do I need to do anything special in order to get the Dynamic Library to Load? Does it need to be in the same folder as the place it is used from? I am developing a Plug-In that calls the Pascal library. When I don't use the pascal library my PlugIn loads and works ok (except that the functionality of the Pascal Library isn't there!!!) but when I make it call and reference the pascal library is doesn't load so I am guessing that the problem is that it is not finding the Pascal library correctly.

All the Best
Dave

On 7 Feb 2007, at 12:28, Jonas Maebe wrote:


On 7 feb 2007, at 13:06, Dave wrote:

2. Try to Compile the Delphi/Pascal code under MacOS X and include it in my XCode C/C++ project.

Since I don't really want to have to re-write the code if I don't have to, I decided to investigate option 2 and was quite pleased to find a Free Pascal Compiler for Intel/MacOS X. I have managed to compile the module into a Dynamic Library. I then included it into my XCode Project and it seemed to accept the file ok, however when I build the project I get undefined errors on the Link phase.

I'm now not sure if the problem lies in the Library file created by Free Pascal or if I have to do something extra in XCode in order to link my C code to the Dynamic Library.

One thing to take into account is that since Pascal has a different namespace for each compilation unit, the default symbol names are different than those which are expected by GCC. If you want to export functions from a Pascal unit/shared library for C use, make sure you do the following:


a) add {$calling cdecl} to all Pascal sources to make sure the used calling conventions matches what GCC expects
b) In your main library Pascal file, specify all exported functions like this:


exports
   AddRTFBibToClipContents name '_AddRTFBibToClipContents',
   AddToTermLists name '_AddToTermLists',
   combineStyledTextDataRB name '_combineStyledTextDataRB',
   ConvertToRTF name '_ConvertToRTF',
   CopyStylesToClipRB name '_CopyStylesToClipRB',
   FormatLib name '_FormatLib',
   ... ;

(don't forget the extra _ at the start of each name). This will set the name of the exported functions to the symbol names that GCC will use.


Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40looktowindward.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Pascal/Delphi and XCode
      • From: Jonas Maebe <email@hidden>
References: 
 >Help Regarding Xcode 2.4 (From: "Lijith P" <email@hidden>)
 >Pascal/Delphi and XCode (From: Dave <email@hidden>)
 >Re: Pascal/Delphi and XCode (From: Jonas Maebe <email@hidden>)

  • Prev by Date: Re: Strange behavior in XCode, not exhibited in Dev-C++
  • Next by Date: Re: Pascal/Delphi and XCode
  • Previous by thread: Re: Pascal/Delphi and XCode
  • Next by thread: Re: Pascal/Delphi and XCode
  • Index(es):
    • Date
    • Thread