Forum > iPhone/iPad

Questions about making iOS library.....

<< < (2/3) > >>

Phil:
Is the Pascal library you're developing specific to iOS or can it be compiled for, say, OS X too. If it's not iOS-specific (for example, does not depend on any iOS frameworks, only FPC RTL), then you can probably do the development with Lazarus, per usual.

A good way of debugging Pascal library code is to compile it into a standalone program in addition to a library. Then you can debug the program per usual as well. For example, in the ndfd example library from the article series above, the source includes a testndfd.pas program that just compiles in the NdfdForecast.pas unit rather than loading the library.

If your library is iOS-specific, then I would not use Lazarus, except perhaps as a code editor. The development of the iOS app that uses the library would likely be done with Xcode, so that's where I would work as much as possible.

-Phil

chenyuchih:

--- Quote from: Phil on May 31, 2016, 10:31:18 pm ---Is the Pascal library you're developing specific to iOS or can it be compiled for, say, OS X too. If it's not iOS-specific (for example, does not depend on any iOS frameworks, only FPC RTL), then you can probably do the development with Lazarus, per usual.

A good way of debugging Pascal library code is to compile it into a standalone program in addition to a library. Then you can debug the program per usual as well. For example, in the ndfd example library from the article series above, the source includes a testndfd.pas program that just compiles in the NdfdForecast.pas unit rather than loading the library.

If your library is iOS-specific, then I would not use Lazarus, except perhaps as a code editor. The development of the iOS app that uses the library would likely be done with Xcode, so that's where I would work as much as possible.

-Phil


--- End quote ---

Wow...What a exciting message! Yes, the library I want to make is non-iOS specific. It's just some engineering algorithm, iteration, calculation, and lot of data(in string). I've maintained it on MS Windows and Android with exact the same code for 2 years and now I want to try it on iOS/OS X without too much modification.

About the GUI design, I would consider the Xcode for better co-working with other partners.

Thanks Phil! I DO APPRECIATE YOUR HELP!

Best Regards,
ChenYuChih

Phil:
I would start with getting the library working on OS X. That way if you have problems you'll know it's due to some difference between Windows and OS X and not something about iOS or arm.

If you can get it working with both 32-bit and 64-bit on OS X, you shouldn't have much trouble getting it to work with 32-bit and 64-bit Simulator and iOS.

I would also create a header file (.h) for the library. Programmers working with Xcode will likely be using Objective C or Swift. Both can use a C header file without any additional changes to it. For Swift programmers, you could even wrap the library functions in Swift classes to make the library easier to use - see the referenced article series for an example for the ndfd library (NdfdLib.swift contains the wrapper class and ndfd.h is the header file).

-Phil

chenyuchih:
Hello,

Sorry for continuing this thread because I don't have better topic for my new questions...

Recently I have time really start my work about porting my project to iOS and I found something strange. My environment is as follows:
Mac OS X 10.13.5
Xcode 9.4.1(and the command line tool)
fpc-3.0.4.intel-macosx.dmg
fpc-3.0.5.intel-macosx.cross.ios.dmg
fpcsrc-3.0.4-macosx.dmg
lazarus-1.8.4-i686-macosx.dmg

1. When I build my library, there's no pain for Darwin-i386, Darwin-x86_64, Darwin-arm, and Darwin-aarch64, all with default target processor. But I noticed that those generated dylib files seems the SAME!! They have complete the same file size!! Then I use the terminal command "file" to check them and the responses I got are all "Mach-O dynamically linked shared library i386". I didn't change any path parameters or special setups after installing fpc/lazarus. Did I miss something else? If so, why there's no error during the whole building process?

2. Another minor question is about the target processor setup. What's the default processor for Darwin-arm? I can build code with "(Default)" but not when changing it to others(ARMV3 to CORTEXM3, got "Error: Illegal parameter: -CpXXX"). I am curious about what processor will be used for default?

Thanks for help. Any response will be appreciated.

Sincerely,
ChenYuChih

chenyuchih:
Hi all,

I tried adding

-ap
-XR/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
-FD/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/

in the Custom options, but got "Error: linker: Undefined symbols for architecture i386:" and fail generating dylib. Looks like the linker still want to link files as i386 even if the compiler option is "-Tdarwin -Paarch64". Is it a bug? Can I fix it manually?

Best Regards,
ChenYuChih

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version