Can Delphi XE7 (Pascal) be used to create a STATIC lib for iOS?

I tried creating a package for iOS Device and compiled it but can't find any ".a" files created anywhere.    Is this something that only can be done in C++, or is there a way to do this in Pascal?   If so, then how is this done...that is, what do I need to do to generate a ".a" static lib for iOS with Delphi (pascal) XE7?

Thanks.  

Jeff
0
Jeff
2/13/2015 1:01:01 AM
embarcadero.delphi.ios 412 articles. 0 followers. Follow

31 Replies
1025 Views

Similar Articles

[PageSpeed] 55

Jeff wrote:

> I tried creating a package for iOS Device and compiled it but can't
> find any ".a" files created anywhere.    Is this something that only
> can be done in C++, or is there a way to do this in Pascal?   If so,
> then how is this done...that is, what do I need to do to generate a
> ".a" static lib for iOS with Delphi (pascal) XE7?

Read the documentation:

http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File

-- 
Remy Lebeau (TeamB)
0
Remy
2/13/2015 1:01:01 AM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}

> Read the documentation:
> 
> http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File
> 

I probably should have mentioned that I did read the documentation, and yes, the documentation does seem to indication that a ".a" file can be created with Delphi.   However,  I'm just not finding any file with the ".a" extension anywhere after building a package, so I'm wondering what I am doing wrong.

ADD:  and also, the link within that documentation called "Building Static Packages" only talks about C++ so that's one reason I'm confused about whether it can be done in Pascal.   Are there any small example projects out there that show how this is done?

Thanks,

Jeff

Edited by: Jeff Yankauer on Feb 13, 2015 7:18 PM
0
Jeff
2/14/2015 1:01:01 AM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}

> Read the documentation:
> 
> http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File
> 

I probably should have mentioned that I did read the documentation, and yes, the documentation does seem to indication that a ".a" file can be created with Delphi.   However,  I'm just not finding any file with the ".a" extension anywhere after building a package, so I'm wondering what I am doing wrong.

ADD:  and also, the link within that documentation called "Building Static Packages" only talks about C++ so that's one reason I'm confused about whether it can be done in Pascal.   Are there any small example projects out there that show how this is done?

ADD2:  and also this documentation implies it can't be done since it says "N/A"  in the columns for both dynamic and static libs for iOS and android.  Does that mean it really can't be done?   Thanks.

Thanks,

Jeff

Edited by: Jeff Yankauer on Feb 13, 2015 7:18 PM

Edited by: Jeff Yankauer on Feb 13, 2015 7:34 PM
0
Jeff
2/14/2015 1:01:01 AM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}

> Read the documentation:
> 
> http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File
> 

I probably should have mentioned that I did read the documentation, and yes, the documentation does seem to indication that a ".a" file can be created with Delphi.   However,  I'm just not finding any file with the ".a" extension anywhere after building a package, so I'm wondering what I am doing wrong.

ADD:  and also, the link within that documentation called "Building Static Packages" only talks about C++ so that's one reason I'm confused about whether it can be done in Pascal.   Are there any small example projects out there that show how this is done?

ADD2:  and also this documentation implies it can't be done since it says "N/A"  in the columns for both dynamic and static libs for iOS and android.  Does that mean it really can't be done?   Thanks. http://docwiki.embarcadero.com/RADStudio/XE7/en/Compiling_and_Building_Multi-Device_Applications

Thanks,

Jeff

Edited by: Jeff Yankauer on Feb 13, 2015 7:18 PM

Edited by: Jeff Yankauer on Feb 13, 2015 7:34 PM

Edited by: Jeff Yankauer on Feb 13, 2015 7:36 PM
0
Jeff
2/14/2015 1:01:01 AM
Jeff Yankauer wrote:
>> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> 
>> Read the documentation:
>>
>> http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File
>>
> 
> I probably should have mentioned that I did read the documentation, and yes, the documentation does seem to indication that a ".a" file can be created with Delphi.   However,  I'm just not finding any file with the ".a" extension anywhere after building a package, so I'm wondering what I am doing wrong.
> 
> ADD:  and also, the link within that documentation called "Building Static Packages" only talks about C++ so that's one reason I'm confused about whether it can be done in Pascal.   Are there any small example projects out there that show how this is done?
> 
> ADD2:  and also this documentation implies it can't be done since it says "N/A"  in the columns for both dynamic and static libs for iOS and android.  Does that mean it really can't be done?   Thanks. http://docwiki.embarcadero.com/RADStudio/XE7/en/Compiling_and_Building_Multi-Device_Applications
> 
> Thanks,
> 
> Jeff
> 
> Edited by: Jeff Yankauer on Feb 13, 2015 7:18 PM
> 
> Edited by: Jeff Yankauer on Feb 13, 2015 7:34 PM
> 
> Edited by: Jeff Yankauer on Feb 13, 2015 7:36 PM

Yes .a files are built.  They are put in teh same directory as the .dcp.  So 
where ever you have that setup to put them is where it should be going as long 
as you have generate C++ files turned on.

Static libs is a c++ concept.  Delphi does not have that.  Static linking is 
done to the dcu no matter what the platform in Delphi.  In C++ it is the .lib 
file and .a file depending on the platform.

If you look in the lib\android and the lib\iOSDevice directories you will see a 
..a for every Delphi runtime package that ships with the product.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
2/14/2015 1:01:01 AM
I looked in the iOSDevice folders and none of the .a files have a corresponding .dcp and vice versa.  I was hoping there would be at least one example of a ".a" that was compiled from a delphi project.    It would be helpful if there were any small example Delphi package project that compiles to a ".a" but so far I haven't found any, so I have no idea what I could be doing wrong.   My target is set to IOSDevice with the iPhone7.1 SDK.   I tried cleaning and rebuilding as well as starting a new progject, b
ut no ".a" files are ever generated. 

> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}

> If you look in the lib\android and the lib\iOSDevice directories you will see a 
> .a for every Delphi runtime package that ships with the product.
> 
> -- 
> Jeff Overcash (TeamB)
>
0
Jeff
2/14/2015 1:01:01 AM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}

> Read the documentation:
> 
> http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File
> 

I probably should have mentioned that I did read the documentation, and yes, the documentation does seem to indication that a ".a" file can be created with Delphi.   However,  I'm just not finding any file with the ".a" extension anywhere after building a package, so I'm wondering what I am doing wrong.

Thanks,

Jeff
0
Jeff
2/14/2015 3:13:22 AM
I enabled generation of C++ files, but there is still no .a file being generated anywhere, including the same directory as  .dcp files.  

What could I be possibly be doing wrong?

> Yes .a files are built.  They are put in teh same directory as the .dcp.  So 
> where ever you have that setup to put them is where it should be going as long 
> as you have generate C++ files turned on.
> 
> Static libs is a c++ concept.  Delphi does not have that.  Static linking is 
> done to the dcu no matter what the platform in Delphi.  In C++ it is the .lib 
> file and .a file depending on the platform.
> 
> If you look in the lib\android and the lib\iOSDevice directories you will see a 
> .a for every Delphi runtime package that ships with the product.
> 
> -- 
> Jeff Overcash (TeamB)
>        (Please do not email me directly unless  asked. Thank You)
> And so I patrol in the valley of the shadow of the tricolor
> I must fear evil. For I am but mortal and mortals can only die.
> Asking questions, pleading answers from the nameless
> faceless watchers that stalk the carpeted  corridors of Whitehall.
>               (Fish)
0
Jeff
2/14/2015 6:24:19 AM
I looked in the iOSDevice folders and none of the .a files have a corresponding .dcp and vice versa.  I was hoping there would be at least one example of a ".a" that was compiled from a delphi project.    It would be helpful if there were any small example Delphi package project that compiles to a ".a" but so far I haven't found any, so I have no idea what I could be doing wrong.   My target is set to IOSDevice with the iPhone7.1 SDK.   I tried cleaning and rebuilding as well as starting a new progject, b
ut no ".a" files are ever generated. 

Also, I need to generate ".a" file(s) because the goal is for a C++ to be able to link to it when it is built.  

> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}

> If you look in the lib\android and the lib\iOSDevice directories you will see a 
> .a for every Delphi runtime package that ships with the product.
> 
> -- 
> Jeff Overcash (TeamB)
>

Edited by: Jeff Yankauer on Feb 13, 2015 11:33 PM
0
Jeff
2/14/2015 7:35:27 AM
I looked in the iOSDevice folders and none of the .a files have a corresponding .dcp and vice versa.  I was hoping there would be at least one example of a ".a" that was compiled from a delphi project.    It would be helpful if there were any small example Delphi package project that compiles to a ".a" but so far I haven't found any, so I have no idea what I could be doing wrong.   My target is set to IOSDevice with the iPhone7.1 SDK.   I tried cleaning and rebuilding as well as starting a new progject, b
ut no ".a" files are ever generated. 

Also, I need to generate ".a" file(s) because the goal is for a C++ to be able to link to it when it is built.  

ADD:  Is there something special that needs to be done for the .a file to be generated?   Does  certain type of object have to be implemented within a unit contained within the package?   In other words, can I create a couple of simple procedures or functions and use exports keyword to export them or is there something else more complicated that needs to be done to get the .a file to generate?  Thanks.

> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}

> If you look in the lib\android and the lib\iOSDevice directories you will see a 
> .a for every Delphi runtime package that ships with the product.
> 
> -- 
> Jeff Overcash (TeamB)
>

Edited by: Jeff Yankauer on Feb 13, 2015 11:33 PM

Edited by: Jeff Yankauer on Feb 14, 2015 8:14 AM
0
Jeff
2/14/2015 4:16:28 PM
Jeff Yankauer wrote:
> I looked in the iOSDevice folders and none of the .a files have a corresponding .dcp and vice versa.  I was hoping there would be at least one example of a ".a" that was compiled from a delphi project.    It would be helpful if there were any small example Delphi package project that compiles to a ".a" but so far I haven't found any, so I have no idea what I could be doing wrong.   My target is set to IOSDevice with the iPhone7.1 SDK.   I tried cleaning and rebuilding as well as starting a new progject,
 b
> ut no ".a" files are ever generated. 
> 

I have 61 .a files and 46 .dcp files in mine.  Note that the .a files will have 
lib prefixed compared to the dcp.

ex

libibxpress.a
ibxpress.dcp

It might be the package output directory you need to check for hte .a.  I have 
for IBX DCP output directory, Package Output Directory and Unit output directory 
all pointing to the same folder and they are placed there for me when I build 
Android or iOSDevice.

> Also, I need to generate ".a" file(s) because the goal is for a C++ to be able to link to it when it is built.  
> 
> ADD:  Is there something special that needs to be done for the .a file to be generated?   Does  certain type of object have to be implemented within a unit contained within the package?   In other words, can I create a couple of simple procedures or functions and use exports keyword to export them or is there something else more complicated that needs to be done to get the .a file to generate?  Thanks.
> 

No just the project options need to have Generate all C++ Builder files 
(including package libs) selected in the Delphi compiler | Output - C/C++ Output 
file generation.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
2/14/2015 5:20:08 PM
> 
> libibxpress.a
> ibxpress.dcp
> 

Okay,  didn't realize lib would be added to the name!..Thanks!  I did a search for lib<mypackagename>.a and it DOES exist.

Just want to confirm that something like the code below will be valid to be linked with a C++ app (or do I need to make it do something more complicated to get this simple "hello world" function implemented?  (which has been tested as part of a Delphi ios app)     

{Code}
Unit IOS_P_Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants;

Procedure ReadWriteTest(Var Out1,Out2:String); cdecl; export;

implementation

Uses System.IOUtils;

Procedure ReadWriteTest(Var Out1,Out2:String);
Var aFile:TextFile; aPath,aString:String;
begin
Out1:= '';
Out2:='';
 aPath := TPath.GetHomePath + PathDelim;
 if FileExists(aPath+'IOSTest.txt') then  {NOTE: IOSTest.txt gets deployed with the app with the word 'Hello' in it}
 Begin
  AssignFile(aFile,aPath+'IOSTest.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(aFile);
  Out1 := aString;
 End;
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Rewrite(aFile);
  WriteLn(aFile,'World');
  CloseFile(aFile);
 if FileExists(aPath+'IOSTest2.txt') then
 Begin
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(AFile);
  Out2 := aString;
 End;
end;

Exports ConvertTheFile;

end.

{Code}
0
Jeff
2/14/2015 5:43:26 PM
> 
> libibxpress.a
> ibxpress.dcp
> 

Okay,  didn't realize lib would be added to the name!..Thanks!  I did a search for lib<mypackagename>.a and it DOES exist.

Just want to confirm that something like the code below will be valid to be linked with a C++ app (or do I need to make it do something more complicated to get this simple "hello world" function implemented?  (which has been tested as part of a Delphi ios app)     

{Code}
Unit IOS_P_Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants;

Procedure ReadWriteTest(Var Out1,Out2:String); cdecl; export;

implementation

Uses System.IOUtils;

Procedure ReadWriteTest(Var Out1,Out2:String);
Var aFile:TextFile; aPath,aString:String;
begin
Out1:= '';
Out2:='';
 aPath := TPath.GetHomePath + PathDelim;
 if FileExists(aPath+'IOSTest.txt') then  {NOTE: IOSTest.txt gets deployed with the app with the word 'Hello' in it}
 Begin
  AssignFile(aFile,aPath+'IOSTest.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(aFile);
  Out1 := aString;
 End;
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Rewrite(aFile);
  WriteLn(aFile,'World');
  CloseFile(aFile);
 if FileExists(aPath+'IOSTest2.txt') then
 Begin
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(AFile);
  Out2 := aString;
 End;
end;

Exports ConvertTheFile;

end.

{Code}

Edited by: Jeff Yankauer on Feb 14, 2015 9:43 AM
0
Jeff
2/14/2015 5:44:01 PM
> 
> libibxpress.a
> ibxpress.dcp
> 

Okay,  didn't realize lib would be added to the name!..Thanks!  I did a search for lib<mypackagename>.a and it DOES exist.

Just want to confirm that something like the code below will be valid to be linked with a C++ app (or do I need to make it do something more complicated to get this simple "hello world" function implemented?  (which has been tested as part of a Delphi ios app)     

This unit is contained in my test package with IOS target:

{Code}
Unit IOS_P_Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants;

Procedure ReadWriteTest(Var Out1,Out2:String); cdecl; export;

implementation

Uses System.IOUtils;

Procedure ReadWriteTest(Var Out1,Out2:String);
Var aFile:TextFile; aPath,aString:String;
begin
Out1:= '';
Out2:='';
 aPath := TPath.GetHomePath + PathDelim;
 if FileExists(aPath+'IOSTest.txt') then  {NOTE: IOSTest.txt gets deployed with the app with the word 'Hello' in it}
 Begin
  AssignFile(aFile,aPath+'IOSTest.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(aFile);
  Out1 := aString;
 End;
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Rewrite(aFile);
  WriteLn(aFile,'World');
  CloseFile(aFile);
 if FileExists(aPath+'IOSTest2.txt') then
 Begin
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(AFile);
  Out2 := aString;
 End;
end;

Exports ConvertTheFile;

end.

{Code}

Edited by: Jeff Yankauer on Feb 14, 2015 9:43 AM

Edited by: Jeff Yankauer on Feb 14, 2015 9:44 AM
0
Jeff
2/14/2015 5:44:51 PM
> 
> libibxpress.a
> ibxpress.dcp
> 

Okay,  didn't realize lib would be added to the name!..Thanks!  I did a search for lib<mypackagename>.a and it DOES exist.

Just want to confirm that something like the code below will be valid to be linked with a C++ app (or do I need to make it do something more complicated to get this simple "hello world" function implemented?  (which has been tested as part of a Delphi ios app)     

This unit is contained in my test package with IOS target:   (does it look okay, or do I need to get involved with NSObjects and all that stuff, just to do a simple read/write test with text files)

{Code}
Unit IOS_P_Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants;

Procedure ReadWriteTest(Var Out1,Out2:String); cdecl; export;

implementation

Uses System.IOUtils;

Procedure ReadWriteTest(Var Out1,Out2:String);
Var aFile:TextFile; aPath,aString:String;
begin
Out1:= '';
Out2:='';
 aPath := TPath.GetHomePath + PathDelim;
 if FileExists(aPath+'IOSTest.txt') then  {NOTE: IOSTest.txt gets deployed with the app with the word 'Hello' in it}
 Begin
  AssignFile(aFile,aPath+'IOSTest.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(aFile);
  Out1 := aString;
 End;
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Rewrite(aFile);
  WriteLn(aFile,'World');
  CloseFile(aFile);
 if FileExists(aPath+'IOSTest2.txt') then
 Begin
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(AFile);
  Out2 := aString;
 End;
end;

Exports ConvertTheFile;

end.

{Code}

Edited by: Jeff Yankauer on Feb 14, 2015 9:43 AM

Edited by: Jeff Yankauer on Feb 14, 2015 9:44 AM

Edited by: Jeff Yankauer on Feb 14, 2015 9:45 AM
0
Jeff
2/14/2015 5:46:19 PM
> 
> libibxpress.a
> ibxpress.dcp
> 

Okay,  didn't realize lib would be added to the name!..Thanks!  I did a search for lib<mypackagename>.a and it DOES exist.

Just want to confirm that something like the code below will be valid to be linked with a C++ app (or do I need to make it do something more complicated to get this simple "hello world" function implemented?  (which has been tested as part of a Delphi ios app)     

This unit is contained in my test package with IOS target:   (does it look okay, or do I need to get involved with NSObjects and all that stuff, just to do a simple read/write test with text files)

{Code}
Unit IOS_P_Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants;

Procedure ReadWriteTest(Var Out1,Out2:String); cdecl; export;

implementation

Uses System.IOUtils;

Procedure ReadWriteTest(Var Out1,Out2:String);
Var aFile:TextFile; aPath,aString:String;
begin
Out1:= '';
Out2:='';
 aPath := TPath.GetHomePath + PathDelim;
 if FileExists(aPath+'IOSTest.txt') then  {NOTE: IOSTest.txt gets deployed with the app with the word 'Hello' in it}
 Begin
  AssignFile(aFile,aPath+'IOSTest.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(aFile);
  Out1 := aString;
 End;
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Rewrite(aFile);
  WriteLn(aFile,'World');
  CloseFile(aFile);
 if FileExists(aPath+'IOSTest2.txt') then
 Begin
  AssignFile(aFile,aPath+'IOSTest2.txt');
  Reset(aFile);
  ReadLn(aFile,aString);
  CloseFile(AFile);
  Out2 := aString;
 End;
end;

Exports ReadWriteTest;

end.

{Code}

Edited by: Jeff Yankauer on Feb 14, 2015 9:43 AM

Edited by: Jeff Yankauer on Feb 14, 2015 9:44 AM

Edited by: Jeff Yankauer on Feb 14, 2015 9:45 AM

Edited by: Jeff Yankauer on Feb 14, 2015 9:46 AM
0
Jeff
2/14/2015 5:46:53 PM
I do not have too mutch experience with this but there are two issues I see.
String type is a Delphi type. Outside Delphi it don't make much sense to return a String. It will be better to use NSString or PChar.
Second issue is that String type is an automatically reference count type. If you call your function outside your library memory manager then String memory will be freed when function ends.

Best regards,
Cristian Peta
0
Cristian
2/14/2015 7:46:43 PM
> {quote:title=Cristian Peta wrote:}{quote}
> I do not have too mutch experience with this but there are two issues I see.
> String type is a Delphi type. Outside Delphi it don't make much sense to return a String. It will be better to use NSString or PChar.
> Second issue is that String type is an automatically reference count type. If you call your function outside your library memory manager then String memory will be freed when 

Thanks,  I've changed the strings to PChars, which are being passed to the function.   However,  I can't get anything to work.  The program always crashes either inside or outside the debugger.   And it doesn't even get to the point of calling my function.   So I'm wondering what I could be doing wrong?   Is it because I'm using the simulator for my project, and .a files won't work at all with the simulator?
0
Jeff
2/14/2015 9:27:49 PM
> {quote:title=Cristian Peta wrote:}{quote}
> I do not have too mutch experience with this but there are two issues I see.
> String type is a Delphi type. Outside Delphi it don't make much sense to return a String. It will be better to use NSString or PChar.
> Second issue is that String type is an automatically reference count type. If you call your function outside your library memory manager then String memory will be freed when 

Thanks,  I've changed the strings to PChars, which are being passed to the function.   However,  I can't get anything to work.  The program always crashes either inside or outside the debugger.   And it doesn't even get to the point of calling my function.   So I'm wondering what I could be doing wrong?   Is it because I'm using the simulator for my project, and .a files won't work at all with the simulator?   

ADD:  In other words, my ".a" file was generated with a target set to IOS Device (since Delphi does NOT appear to generate a ".a" file for the simulator.   So am I correct in assuming that a ".a" generated for iOS Device - iPhone OS 7.1 target will not work with an app that is using iPhoneSimulator 7.1, is that correct?

Edited by: Jeff Yankauer on Feb 14, 2015 1:39 PM
0
Jeff
2/14/2015 9:41:15 PM
> {quote:title=Cristian Peta wrote:}{quote}
> I do not have too mutch experience with this but there are two issues I see.
> String type is a Delphi type. Outside Delphi it don't make much sense to return a String. It will be better to use NSString or PChar.
> Second issue is that String type is an automatically reference count type. If you call your function outside your library memory manager then String memory will be freed when 

Thanks,  I've changed the strings to PChars, which are being passed to the function.   However,  I can't get anything to work.  The program always crashes either inside or outside the debugger.   And it doesn't even get to the point of calling my function.   So I'm wondering what I could be doing wrong?   Is it because I'm using the simulator for my project, and .a files won't work at all with the simulator?   

ADD:  In other words, my ".a" file was generated with a target set to IOS Device (since Delphi does NOT appear to generate a ".a" file for the simulator.)   So am I correct in assuming that a ".a" generated for iOS Device - iPhone OS 7.1 target will not work with an app that is using iPhoneSimulator 7.1, is that correct?

Edited by: Jeff Yankauer on Feb 14, 2015 1:39 PM

Edited by: Jeff Yankauer on Feb 14, 2015 1:41 PM
0
Jeff
2/14/2015 9:42:11 PM
Jeff Yankauer wrote:
>> {quote:title=Cristian Peta wrote:}{quote}
>> I do not have too mutch experience with this but there are two issues I see.
>> String type is a Delphi type. Outside Delphi it don't make much sense to return a String. It will be better to use NSString or PChar.
>> Second issue is that String type is an automatically reference count type. If you call your function outside your library memory manager then String memory will be freed when 
> 
> Thanks,  I've changed the strings to PChars, which are being passed to the function.   However,  I can't get anything to work.  The program always crashes either inside or outside the debugger.   And it doesn't even get to the point of calling my function.   So I'm wondering what I could be doing wrong?   Is it because I'm using the simulator for my project, and .a files won't work at all with the simulator?   
> 
> ADD:  In other words, my ".a" file was generated with a target set to IOS Device (since Delphi does NOT appear to generate a ".a" file for the simulator.)   So am I correct in assuming that a ".a" generated for iOS Device - iPhone OS 7.1 target will not work with an app that is using iPhoneSimulator 7.1, is that correct?
> 
> Edited by: Jeff Yankauer on Feb 14, 2015 1:39 PM
> 
> Edited by: Jeff Yankauer on Feb 14, 2015 1:41 PM

iPhoneSimulator is a different CPU than the iPhone so no the iOSDevice .a 
library is not used in the simulator.

You would get a linker error and not even be able to run if it could not find 
the C++ binary files needed for the simulator.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
2/15/2015 12:06:21 AM
> Static libs is a c++ concept.  Delphi does not have that.  Static linking is 
> done to the dcu no matter what the platform in Delphi.  In C++ it is the .lib 
> file and .a file depending on the platform.


Ok, so I guess this means that the only way to actually test out a ".a" file to see if it works is with another development environment like XCode on the Mac.   I could test out my code itself using DCUs, but the only way to confirm my function declarations (or whatever)  are actually valid to use in a ".a" and that the ".a" can actually be properly linked into an application (that is the ".a" actaully works and won't be rejected)  is to use another development environment that can actually link it in.

Edited by: Jeff Yankauer on Feb 15, 2015 7:41 AM
0
Jeff
2/15/2015 1:01:01 AM
Jeff wrote:

> iPhoneSimulator is a different CPU than the iPhone so no the iOSDevice
> .a library is not used in the simulator.

And this is clearly stated in the documentation:

Package Static Library File (*.lib, *.a)
http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Static_Library_File

{quote}
The file name of your package static library file is: 
....
lib<package>.a for iOS Device and Android. 

Note: You can not generate a package static library file for iOS Simulator.
{quote}

-- 
Remy Lebeau (TeamB)
0
Remy
2/15/2015 1:02:18 AM
> {quote:title=Jeff Yankauer wrote:}{quote}
> Thanks,  I've changed the strings to PChars, which are being passed to the function.   However,  I can't get anything to work.  The program always crashes either inside or outside the debugger.   And it doesn't even get to the point of calling my function.   So I'm wondering what I could be doing wrong?   Is it because I'm using the simulator for my project, and .a files won't work at all with the simulator?   
> 
> ADD:  In other words, my ".a" file was generated with a target set to IOS Device (since Delphi does NOT appear to generate a ".a" file for the simulator.)   So am I correct in assuming that a ".a" generated for iOS Device - iPhone OS 7.1 target will not work with an app that is using iPhoneSimulator 7.1, is that correct?
> 
> Edited by: Jeff Yankauer on Feb 14, 2015 1:39 PM
> 
> Edited by: Jeff Yankauer on Feb 14, 2015 1:41 PM
For iOS Simulator you need .dylib (Mac OS X) library. It is only a Simulator, actually your app be compiled for x86 and will run under OS X.
http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Shared_Library_File

The static library for iOS is compiled for ARM. It will not run in anyway in iOS Simulator because it requires x86.
If you really want to test you static library you need a device. But if your .dylib will work almost sure .a will work too.

Best regards,
Cristian Peta
0
Cristian
2/15/2015 5:54:11 AM
I was told that only an actual dylib could be compiled with XE7 for OSX, but not for iOS at this time.

Thanks.

Jeff

> For iOS Simulator you need .dylib (Mac OS X) library. It is only a Simulator, actually your app be compiled for x86 and will run under OS X.
> http://docwiki.embarcadero.com/RADStudio/XE7/en/Package_Shared_Library_File
> 
> The static library for iOS is compiled for ARM. It will not run in anyway in iOS Simulator because it requires x86.
> If you really want to test you static library you need a device. But if your .dylib will work almost sure .a will work too.
> 
> Best regards,
> Cristian Peta
0
Jeff
2/15/2015 3:36:53 PM
> Static libs is a c++ concept.  Delphi does not have that.  Static linking is 
> done to the dcu no matter what the platform in Delphi.  In C++ it is the .lib 
> file and .a file depending on the platform.


Ok, so I guess this means that the only way to actually test out a ".a" file to see if it works is with another development environment like XCode on the Mac.   I could test out my code using DCUs, but the only way to confirm my function declarations (or whatever)  are actually valid to use in a ".a" is to use another development environment, right?
0
Jeff
2/15/2015 3:41:10 PM
> Static libs is a c++ concept.  Delphi does not have that.  Static linking is 
> done to the dcu no matter what the platform in Delphi.  In C++ it is the .lib 
> file and .a file depending on the platform.


Ok, so I guess this means that the only way to actually test out a ".a" file to see if it works is with another development environment like XCode on the Mac.   I could test out my code itself using DCUs, but the only way to confirm my function declarations (or whatever)  are actually valid to use in a ".a" and that the ".a" can actually be properly linked into an application, is to use another development environment that can actually link it in.

Edited by: Jeff Yankauer on Feb 15, 2015 7:41 AM
0
Jeff
2/15/2015 3:42:50 PM
> Static libs is a c++ concept.  Delphi does not have that.  Static linking is 
> done to the dcu no matter what the platform in Delphi.  In C++ it is the .lib 
> file and .a file depending on the platform.


Ok, so I guess this means that the only way to actually test out a ".a" file to see if it works is with another development environment like XCode on the Mac.   I could test out my code itself using DCUs. to see if the code itself works,  but the only way to confirm my function declarations (or whatever)  are actually valid to use in a ".a" and that the ".a" can actually be properly linked into an application (that is the ".a" actaully works and won't be rejected)  is to use another development environmen
t that can actually link it in.

Edited by: Jeff Yankauer on Feb 15, 2015 7:41 AM
0
Jeff
2/15/2015 3:45:30 PM
".a" files are created when compiling packages for the appropriate target environments.  However,   ".a" files are NOT created by XE7 if building a package for the iOS simulator.  Also, ".a" files for iOS devices have "lib" added to the *beginning* of the ".a" file name.   

Further,  my understanding, as of this writing, is that XE7 (pascal) can not link in any ".a" file(s) to any type of XE7 target application.   That is, XE7 can create ".a" files when building packages, but not link them into any XE7 apps.
0
Jeff
2/15/2015 3:51:05 PM
<Deleted>

Edited by: Jeff Yankauer on Feb 15, 2015 7:52 AM
0
Jeff
2/15/2015 3:52:52 PM
<Deleted>
0
Jeff
2/15/2015 3:53:29 PM
Reply:

Similar Artilces:

I can to install one not delphi program foir iOS into one iOS for delphi?
For example i have one programm builded as xcode for iOS, and i build one program as delphi for iOS. I want to have only one instalation, i can to add this xcode program into my delphi installer of my ios program? I can to do the same as android? how i can to to this? > {quote:title=oscar mejia wrote:}{quote} > For example i have one programm builded as xcode for iOS, and i build one program as delphi for iOS. I want to have only one instalation, i can to add this xcode program into my delphi installer of my ios program? > > I can to do the same as android? how i can to to...

Can Delphi for iOS can create facebook-like sidepanel?
I was looking on this Cocoa control that allows to have the sliding sidebar on the left. https://www.cocoacontrols.com/controls/jasidepanels Can I do something similar with Delphi/Firemonkey? > {quote:title=George Karras wrote:}{quote} > I was looking on this Cocoa control that allows to have the sliding sidebar on the left. > https://www.cocoacontrols.com/controls/jasidepanels > > Can I do something similar with Delphi/Firemonkey? This might help: http://www.delphifeeds.com/go/s/103536 Thank you so much! ...

Can I do this with iOS apps developed in Delphi XE4 Pro + iOS?
I still don't have XE4/iOS as I have some questions first. Do I have access to iOS "native" library/system? What do I use for internet (downloading files etc.) - Indy? *If my research is correct, Google maps is available for iOS? Can I use Google maps or Apple's maps solutions in Delphi iOS apps?* If I have XE4 Pro, can I still use database functionality? Any restrictions? (Am I allowed to use what iOS offers or connect with a database on a webserver?) Anyone here developed demo apps I can see available in Apple iTunes store? (Even simple apps is okay as I only have plans of developing some relative simple apps here at first) Hello Thomas, > Do I have access to iOS "native" library/system? Yes. And just like on Windows, you would have to translate any APIs to Delphi that Embarcadero has not already translated for you. > What do I use for internet (downloading files etc.) - Indy? That is one option, yes. > Anyone here developed demo apps I can see available in Apple iTunes > store? (Even simple apps is okay as I only have plans of developing > some relative simple apps here at first) There have been a couple of Delphi iOS apps successfully submitted to the App Store. -- Remy Lebeau (TeamB) > Anyone here developed demo apps I can see available in Apple iTunes store? (Even simple apps is okay as I only have plans of developing some relative simple apps here at first) yes check mine:...

IOS Setup in Delphi help
Could someone check this document for me, since I cannot get my Delphi to talk properly anymore with my Mac and compile for my Test, adhoc and App Store. Had to reinstall my laptop, and forgot those settings, and I am at a loss. I added some screens in it, so you know what I all did. Could someone take a look at it, and tell me what's wrong / missing etc? Thank you ...

IOS Setup in Delphi help
Could someone check this document for me, since I cannot get my Delphi to talk properly anymore with my Mac and compile for my Test, adhoc and App Store. Had to reinstall my laptop, and forgot those settings, and I am at a loss. I added some screens in it, so you know what I all did. Could someone take a look at it, and tell me what's wrong / missing etc? Thank you ...

IOS Setup in Delphi help
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_8d526.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" --JivePart=_8d526.zeB8CwDOH5aMJzMl Content-Type: application/msword; name="Create Profile for Delphi.doc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Create Profile for Delphi.doc" 0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAAFAAAAbwIAAAAAAAAA EAAAcQIAAAEAAAD+////AAAAAGoCAABrAgAAbAIAAG...

Is it possible to link a static lib in delphi xe4 for IOS
From what is new in the XE4 , I can not find arm linker option can be used to link a static lib. Because apple store will reject any app that uses a 3rd dylib, then we can not use a 3rd library such as AFNetwork , etc with delphi if no such support . best regards chen xing wrote: > From what is new in the XE4 , I can not find arm linker option can be used to link a static lib. Because apple store will reject any app that uses a 3rd dylib, then we can not use a 3rd library such as AFNetwork , etc with delphi if no such support . > > best regards Yes it can link appropriate ...

Creating iOS Apps Using Delphi XE2 (webinar)
Register here: http://forms.embarcadero.com/forms/AMUSCA1206RADMobileWebinar6-06 Feel free to tune in tomorrow (June 6th) at 6am, 11am or 5pm PDT. That should be 1pm UTC, 6pm UTC and 12am (June 7th) in UTC. PS: MathViz 1.1 for iOS is now free in the AppStore. Enjoy! -- Anders Ohlsson - http://blogs.embarcadero.com/ao/ Embarcadero Developer Relations "A golf course that does not have a pub after the 18th hole is like an acupuncturist who does not offer needle removal." > {quote:title=Anders Ohlsson wrote:}{quote} > Register here: > > http://...

Creating iOS Apps Using Delphi XE2 (webinar)
Register here: http://forms.embarcadero.com/forms/AMUSCA1206RADMobileWebinar6-06 Feel free to tune in tomorrow (June 6th) at 6am, 11am or 5pm PDT. That should be 1pm UTC, 6pm UTC and 12am (June 7th) in UTC. PS: MathViz 1.1 for iOS is now free in the AppStore. Enjoy! -- Anders Ohlsson - http://blogs.embarcadero.com/ao/ Embarcadero Developer Relations "A golf course that does not have a pub after the 18th hole is like an acupuncturist who does not offer needle removal." ...

How to create iOS Service application using delphi XE8
Hi, I'm using Delphi XE8 for developing mobile application. In that I have tried to create Service application for Android and iOs. And from the internet I found some of the sample code for developing Service application in Android. [Sample code for Android Service application|http://blog.blong.com/2013/11/delphi-and-android-services.html] . And Please provide me any sample code for developing Service Application for iPhone(iOs) or is the same code can be used for iPhone also. Please help me in this. Thanks A lot. https://developer.apple.com/library/ios/documentation/iPhone/Concept...

Can Delphi XE4 import iOS ObjC Class ? ( Static Library *.a )
Can Delphi XE4 import iOS ObjC Class ? ( Static Library *.a ) ObjC Code : test.a ---------------------------------------------------------------------- // test.h --- #import <Foundation/Foundation.h> @interface mycalc : NSObject { BOOL busy; } - (int) calc : (int) value; @end // test.m --- #import "test.h" @implementation mycalc -(int) calc:(int)value { busy = TRUE; return ( value + 1); } @end Delphi XE4 Code for Testing ----------------------------------------------------------------------------- Unit1; interface uses Syst...

Can Delphi XE7 Pro with the Mobile Add-On Pack compile a dylib for iOS?
A group that I work with has pascal code that we're looking to compile into a dylib for iOS. We're told that newer versions of iOS support the use of dylibs. Is it possible to use Delphi XE7 Pro with the Mobile Add-On Pack to create a dylib for iOS? If so, then how is this done? If not, then will future versions of Delphi support creation of dylibs for iOS? Thanks. Jeff > {quote:title=Jeff Yankauer wrote:}{quote} > A group that I work with has pascal code that we're looking to compile into a dylib for iOS. We're told that newer versions of iOS support th...

Delphi XE7, iOS and InputQuery
I would like to use an 'InputQuery' component to request a Username and Password from the user. I am able to achieve my goal with my Android app but not with my iPad one. 'InputQuery' only requests one of the two values. Am I doing something wrong or is 'InputQuery' not working properly on iOS? ...

using lib .so in Delphi XE7
I needed a help, if possible ??? It is this: I have a routine written and compiled in C ++ that make data sync a bank with any SQL lite on Windows, one console TCP IP data exchange between environments. Routine name: libfastsync.so (This routine is the client of my console) Question: How do I incorporate this routine into the Delphi XE7 and use it in my application,,,, u have a sample outside call? I know it's possible,,, so,,, do not know how beginner stuff !! Would have an example of this call? Since already thank you Thank you for Remmy tip, but most have some doubts ...

can i use delphi 2007 bpls in delphi 2009
can i use delphi 2007 bpls in delphi 2009 ? "Gaetan SIRY" skrev i meddelelsen news:8703@forums.codegear.com... > can i use delphi 2007 bpls in delphi 2009 ? No. -- Finn Tolderlund The compatiblity between D2006 and D2007 was unique. Normaly they can't be compatible because new version enhance/change the API. And D2009 defines String = Unicode where older version has String = Ansistring so D200x/Dx-BPL are 200% incompatible with D2009. ...

Does Delphi for iOS come with native iOS UI controls?
According to this link http://www.embarcadero.com/products/delphi/ios-development, Delphi for iOS comes with "Pixel-perfect native UI controls". Are those controls the iOS native ones (UILabel, UIText, UISwitch, MKMapView, etc.), i.e. the same ones that one sees in XCode InterfaceBuilder? Le 31/01/13 19:02, Jacques Gonzalez a écrit : > According to this link http://www.embarcadero.com/products/delphi/ios-development, > Delphi for iOS comes with "Pixel-perfect native UI controls". > > Are those controls the iOS native ones (UILabel, UIText, UIS...

Using C libraries with Delphi and iOS
Is it possible to combine C code with a Delphi app for iOS? I have some legacy C libraries I'd like to use use with an iPad application. iOS support is provided by FPC and FPC does allow the linking in of C object files generated using gcc. However, this being iOS there could be limitations as to exactly what can be included. Just try it and see if it works. Regards Mike <Herbert Sauro> wrote in message news:460246@forums.embarcadero.com... > Is it possible to combine C code with a Delphi app for iOS? I have some > legacy C libraries I'd like to use use with...

Using MessageUI in Delphi XE5-iOS
Does anyone here have a clue how I should be able to send emails using the MessageUI on iOS? Afaik it's not natively supported by DelphiXE5. I need to send out an email with a file attached (no bitmap so the Media Library's share sheet won't do). If there are better ways to achieve this then suggestions are welcome also. t.i.a. Hert Hert Vanzet wrote: > Does anyone here have a clue how I should be able to send emails using the MessageUI on iOS? Afaik it's not natively > supported by DelphiXE5. You can use either Indy (TIdSMTP) component, or use DPF: ht...

Delphi XE7 and iOS Mobile pack
I recently bought D-XE7 Professional and the Mobile pack. I installed as per instructions (I think). I was never asked to register the Mobile pack, even though I was sent a registration code. I can open XE7 fine, but I am not able to do anything with mobile apps. I suspect I somehow need to enter my mobile pack registration numbers, but I can't figure out where. Anyone know? - - Dave When you run the install enter the mobile pack serial number instead of the Pro version serial number. Select Modify, Repair, Uninstall from Embarcadero RAD Studio XE7 group in the start menu. Selec...

Delphi XE4 - Firemonkey
I have an application that runs fine on windows, however when running on iOS simulator the onKeyUp event for a TEdit control is not being fired? Please advise if this event should get fired when running on iOS? This problem occurs onKeyUp events created directly on the control and by assigning the event programatically. Running XE4 update 1 iPhoneOS6.1.sdk Minimac: OS X 10.9 XCode 5 iOS Simulator Version 7.0 - iPad Retina / iOS 7.0.3(11B508) ...

File read write on iOS using Delphi
Does anyone have sample code that shows how to read and write files on iOS device in Delphi? Or any other information on that topic? How is file i/o in iOS different on the Simulator and the actual iOS device itself? Thanks! Almost same in windows , but r/w speed is much slower :) {code} // // iOS Native Graphic Wrapper for Delphi // unit iOS_Files; interface {$mode delphi} {$modeswitch objectivec1} uses SysUtils, Types, Classes, Variants, Math, UITypes, CFBase,CFURL, CGContext,CGGeometry,CGColorSpace, iPhoneAll, NSHelpers, // By P...

Delphi XE5 can not find iOS SDK
I have just installed xCode and XE5 and configured connection profile and OS X SDK, but it does not show iOS platform. In the "Select a platform" dropdown, I can only see OS X. When I have turned verbose mode on in PAserver, I can see the command *"/usr/bin/xcodebuild" -version -sdk* being issued, which I believe is used to inform Delphi about the SDKs being installed. When I run the command manually I get a list which for me looks correct, but Delphi stil only shows OS X as a platform and MacOSX 10.8.5 and MacOSX 10.9.2 as alternative SDL versions. The complete outp...

Using ZBar with Delphi XE4 app for iOS
I found a free SDK to scan the QR-codes (http://zbar.sourceforge.net/) and I want to use in the my app for iOS, but I can't find an example of its use in delphi xe4 applications for ios. Is there a possibility of using the SDK for ios in delphi xe4 or use static libraries (*.a) for ios is not allowed? > {quote:title=Sergey Kukharev wrote:}{quote} > I found a free SDK to scan the QR-codes (http://zbar.sourceforge.net/) and I want to use in the my app for iOS, but I can't find an example of its use in delphi xe4 applications for ios. Is there a possibility of using the SDK for i...

I will never use Delphi for iOS development
I posted an article on my blog explaining why I would never use Delphi for anything other than Windows development: http://mihaelamj.com/delphi/i-will-never-use-delphi-for-ios-development/ I just wanted to point out the "(BTFTJ) best tool for the job" paradigm, and when it comes to Delphi, the job is done on Windows. I love Delphi, I'm still using it and will continue to use in the future. But I just want other developers no to be seduced by "do it all in Delphi" frame of mind, because that is just plain wrong (BTFTJ agin). Cheers There is a bug in your b...