dynamic-linking

Is there a way to get a class by name?

爷,独闯天下 提交于 2019-12-01 04:12:37
问题 In Objective-C, is there a way to get a class and send messages to it when you have the name of the class as a string? For example, is there a function func where func(@"NSString") == [NSString class] ? The reason that I want to know this is I am building a dynamic linker library for a language I am working on, and I want it to have an interface to Objective-C libraries. 回答1: Yes — two, in fact. If you have a Foundation-type framework (e.g. from Cocoa, Cocoa Touch or GNUstep), you can use the

DYLD_PRINT_STATISTICS not showing anything

你说的曾经没有我的故事 提交于 2019-12-01 04:12:09
问题 I'm trying to profile app startup after moving from static libraries to frameworks. We have 30 or so frameworks (fyi: cocoapods) so I want to check that it's not affecting performance. Anecdotal testing in the team says that it isn't, but I would like some numbers as well! I've added the environment variables DYLD_PRINT_STATISTICS and DYLD_PRINT_LIBRARIES to see what the linker is doing, but all the output I get is from the DYLD_PRINT_LIBRARIES variable. I can see that the frameworks are

C++ Visual Studio: linking using pragma comment

百般思念 提交于 2019-12-01 03:06:04
I came across a piece of code which uses #pragma comment(lib, "libraryname"). Why this type of usage as opposed to just linking the library from the properties menu? In what situations is this usage called for? I am in windows using C++ Visual Studio 2010 . It would be nice to see an example which calls for this type of usage. Alex F The library writer can place a #pragma comment(lib, ...) command in the public header (.h) file. In this case, the client doesn't need to add this library to the linker dependencies list. By including an h-file in the program, the client is automatically linked to

C++ Visual Studio: linking using pragma comment

落花浮王杯 提交于 2019-11-30 23:02:20
问题 I came across a piece of code which uses #pragma comment(lib, "libraryname"). Why this type of usage as opposed to just linking the library from the properties menu? In what situations is this usage called for? I am in windows using C++ Visual Studio 2010. It would be nice to see an example which calls for this type of usage. 回答1: The library writer can place a #pragma comment(lib, ...) command in the public header (.h) file. In this case, the client doesn't need to add this library to the

Android Static Linking vs Dynamic Linking against glibc

与世无争的帅哥 提交于 2019-11-30 19:20:11
I have been cross-compiling some Linux tools (and some of my own C code) to Android and one of the challenges that I face is that Android's libc has some missing/stripped components and I end up patching my code to make it work with Android's libc (for e.g. a problem like this http://credentiality2.blogspot.com/2010/08/compile-ncurses-for-android.html ) Q1 : How do I go about statically linking against glibc (and other dependencies) while cross-compiling with the arm toolchain (or ndk-build)? Q2 : Is it a good idea to statically link against glibc for binaries for Android? Should I expect

How to generate a dynamic link for a specific post in android firebase

走远了吗. 提交于 2019-11-30 18:10:53
问题 am developing an e-commerce app with android and firebase. I understand how to create dynamic link with firebase console. However I want to be able to create dynamic links for each product when a user click on the share button. I mean when a user clicks on the share button they should be able to share a link that contains some details of that specific product so that when someone clicks on the link they can be taken to the product details activity if they have the app installed. I have tried

How can LD_LIBRARY_PATH be changed within CMake?

本小妞迷上赌 提交于 2019-11-30 17:08:59
I have a local shared library which is not in $LD_LIBRARY_PATH. I want to run my executable, but since it cannot find the shared library in the system folders, it outputs "error while loading shared libraries". A possible fix for this is to export a new LD_LIBRARY_PATH containing the local library folder. How can I export automatically this environment variable within CMake? If your shared lib is not build in the same CMake project of your executable, you can use the CMake rpath handling like this: set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) When you will run make install , CMake will

How to determine if an OS X dylib was linked with -flat_namespace

限于喜欢 提交于 2019-11-30 16:12:20
I have a third party OS X dylib that I'm using in my app and don't have easy access to its creator. I'd like to determine if it was linked with -flat_namespace. Is that possible? If so, how? Run otool -hV on the library. If you don't see TWOLEVEL , then it was linked with -flat-namespace . For example: twolevel.dylib: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 8 672 NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS versus flat.dylib: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags MH_MAGIC_64 X86_64 ALL

Is it possible to statically link against a shared object?

痴心易碎 提交于 2019-11-30 09:15:13
问题 My question is not the same as this question. I'm working on a project with a standalone binary that has no dynamic/external linkage, and runs in a *nix environment. I'm attempting to move to a newer toolset to build with, but some of the static libraries that are available with the older toolset aren't available now -- for example, the crt libraries that provided _start aren't provided in this toolset. I've been digging through the files provided with the vendor's toolset and found some

How can an autotools user specify a combination of static & dynamic linking?

牧云@^-^@ 提交于 2019-11-30 09:04:27
I'm building a program with autoconf, automake, and libtool. My work requires that I statically link (most) libraries. This hasn't been a problem in the past because I could statically link everything with -all-static . Now it's a problem because I have to use a library which is only dynamic; it was given to us by a thirdparty, and we don't have the source. Of course, -all-static now causes the build to fail. Is it possible to tell libtool to statically link everything, except for this one library? Is it possible to have libtool do any combination of static and dynamic linking, or is it all or