Printing objects inside a lib file - iphone

What is the command to print .o files inside a .a file inside ?

man ar tells you the syntax is ar t name/of/lib as in ar t /usr/lib/libc.a

Related

How to access a .swift file in a different folder from main.swit file on replit for Swift?

I've been using replit to program using Swift and I have divided the code into different swift files and respective folders how to access these files from the main.swift file. the import option isn't applicable and the replit error output is that such a class can't be found in the scope. The classes are respective methods are declared as public too.
When you try to compile multiple files on replit, you need to manually add other files to the compile configuration.
To do so, on the file directories, there's a three dot icon you can click, where you can select Show hidden files:
Then you would be able to see a hidden config file called .replit, where you can append other files needed to the compile:
compile = ["swiftc", "-o", "main", "main.swift", "other_file.swift"]
Or compile with all files ended with .swift extension:
compile = "swiftc -o main $(find . -type f -name '*.swift')"

Can't force gcc linker remove unuse function

I use gcc (via eclipse) to compile c code with .a file staticly , But I saw that the final binary file contains function from .a file that I don't call them from my C code.
I don't have the source code of .a file , only the .a file itself.
Tried to remove them by add -Wl,-gc-sections and -ffunction-sections to gcc , but still I saw many function in final binary file from .a file that didn't called from my c code.
Why is that?

Importing a Swift file into another which are in different directories

I am new to swift and I want to use a function which in a.swift in b.swift. a.swift, b.swift are in directory dir1 & dir2. dir1 & dir2 are in same directory.
If you are doing it in iOS project then there is no need to import class/struct from other file which is inside any subdirectory inside project root directory . They are automatic available to use .

How can I make ExtUtils::Manifest include empty directories?

I am trying to build a Perl module for distribution. The directory structure looks like this:
demo
demo/files
demo/examples/example1.pl
demo/scripts
lib
I used this command to generate the MANIFEST file:
perl -e "use ExtUtils::Manifest qw(mkmanifest); mkmanifest();"
The file is created but all of the empty folders are ignored, so demo/files and demo/scripts are not in the MANIFEST.
How can I tell ExtUtils::Manifest to include empty folders?
Create a zero byte file called .exists in the otherwise empty directories.

lattice-tool path issue

I have downloaded and installed a perl tool (lattice-tool).
But it is in my local directory.
While I'm running it says can't locate Directed.pm(a lib file) which is available in lib folder of my local directory.
I hope it will be set right if I set path variable. If so, how do I set it?
For use lib you have to use full path, and you are should not use relativ path like this.
use '../lib';#not working in all times.
Scenario: Your scripts in something/bin/prog.pl, your lib is something/lib/lib.pm.
If you use relativ path, you should call your program like this:
cd something/bin/ && ./prog.pl
If you would like to use relativ path, use FindBin to find your current path:
use FindBin;
use lib "$FindBin::Bin/../lib";#your lib realitv to your script
use lib $FindBin::Bin;#your current script full path
Then you could call your program from anywhere it will always find its lib realtiv to itself.
cd ~
something/bin/prog.pl# ti will use the correct lib
In my scripts, I have the following (which I'm sure can be improved, but it has worked thus far):
my $mydir; BEGIN { ($mydir) = ($0 =~ m#(.*)[/\\]#) or $mydir = '.'; }
use lib "$mydir/lib";
So the script tries to determine its own directory and then tells Perl to look for libraries within the lib subdirectory of that directory.
You need to add 'lib' to the directories perl searches for modules. You can do this with the -I flag:
perl -Ilib lattice-tool.pl
Use lib:
use lib 'lib';
lib also checks for architecture specific sub directories under lib to make sure machine-dependent libraries are loaded.
EDIT: Note that directories passed to lib are relative to your current working directory, so that if you want to execute your script from another location you should use use lib '/home/user1126070/lib'.
From perlvar:
The array #INC contains the list of places that the do EXPR , require, or use
constructs look for their library files. It initially consists of the arguments
to any -I command-line switches, followed by the default Perl library, probably
/usr/local/lib/perl, followed by ".", to represent the current directory. ("."
will not be appended if taint checks are enabled, either by -T or by -t .) If you
need to modify this at runtime, you should use the use lib pragma to get the
machine-dependent library properly loaded [...]