w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Setting Storyboard.Targetname on a storyboard defined as a static resource
I think you're going to need to do this with a custom attached property. You would clone the Storyboard, and set the TargetName on the clone, and return it. Your class would look like this: public static class NamedStoryboard { public static readonly DependencyProperty StoryboardProperty = DependencyProperty.RegisterAttached( "Storyboard", typeof(Storyboard), typeof(NamedStoryboard), new FrameworkPropertyMetadata(DoAttach)); [AttachedPropertyBrowsableForType(typeof(BeginStoryboard))] public static Storyboard GetStoryboard(BeginStoryboard obj) { return (Storyboard)obj.GetValue(StoryboardProperty); } public static void SetStoryboard(BeginStoryboard obj, Storyboard value) { obj.SetValue(StoryboardProperty, value); }

Categories : C#

Linking a static boost build into a static library under VS2012 & Win32/64
This is by design. When building a static library, any dependencies to that library will not get linked into the library directly. Instead when building an executable all library dependencies (direct and indirect) will be linked directly to that executable. This is also the way most compiler handle static libraries. While VS does offer a special option to link dependencies into static libs, this is not possible on e.g. gcc without resorting to dirty file hacks. Since CMake only supports features that can be used on all supported generators, CMake will not allow to do this even on VS builds. You have a couple of options now: Use a dll instead of a static library (add_library(${libname} SHARED ...)). While a static library is basically a bunch of object files wrapped together, a dll is

Categories : Visual Studio

Static Library added as sub-project vs static library added as target
Depending on your needs you can use Pods, static or adding it to the project. If you add a library as a "subproject" is useful when you are working on the 2 projects at once. For example if you add something new to the library you just compile the library and voila you have access to the new library in your project. However if you just link the static library you will have to open the project for the library then build then replace it in the library and add the new headers witch is a lot of setup work.

Categories : IOS

Distributing Windows C++ library: how to decide whether to create static or dynamic library?
There are significant advantages to both static and dynamic (shared) libraries. Maybe one option for you is to distribute both types of libraries, and let the library users decide which to use. For myself, I usually use static libraries unless I think the advantages of a dynamic library are meaningful for the project. Among the advantages of a static library: Once linked in at compile-time by the user of the library, the code in the library is always in the same module that needs to call it. So no DLL hell, and no side-by-side hell. I cannot count the number of times I've tried to run a program on Windows only for it to fail because I don't have the right version of the MSVC runtime (DLL) installed. This is really a pain and if it can be avoided, it makes everyone's life easier. Si

Categories : C++

LNK2001 and LNK1120 when compiling a x64 dynamic library linking a x86 static library
You can not - in other words, there is NO WAY to - link a 32-bit library with a 64-bit executable or DLL (or a 32-bit executable to a 64-bit DLL or vice versa). You will either have to compile your .DLL/.EXE as 32-bit, or find a 64-bit version of the 32-bit library. No other solution! The 64-bit architecture is different from the 32-bit architecture in several aspects, but most importantly, the addresses (pointers) are 64-bit in a 64-bit architecture, which prevents almost any 32-bit code from working correctly in a 64-bit environment (because the upper 32 bits of the addresses are lost, which doesn't produce anything meaningful).

Categories : C++

How to add a button to static UITableView using storyboard
By adding the UIButton directly at the end of your table view, you're making it the table view footer, and the table view footer is required to take the whole table view width. Try replacing your UIButton with a UIView, and add the UIButton in this UIView:

Categories : Objective C

Static initializer of shared library inside dynamic library
The all_load and force_load linker flags only ensure that the code is linked into the binary. I don't think these flags will help you. The only guarantee that I think you can count on is that your initializer in myclass.cpp will be called before any other code in the same cpp file is called. You need to expose access to your default via a function. This would be similar to the Singleton pattern. For example: //myclass.hpp class MyClass { ... static MyClass *getDefaultValue(); ... } ... //myclass.cpp static MyClass* defaultValue_; // Note that this is not a member variable MyClass* MyClass::getDefaultValue() { if (defaultValue_ == nullptr) { defaultValue_ = newInitialDefaultValue(); } return defaultValue_; } ... NOTE: I made no attempt to make this t

Categories : C++

dlopen a dynamic library from a static library linux C++
There should be no problem with what you're trying to do: app.c: #include "staticlib.h" #include "stdio.h" int main() { printf("and the magic number is: %d ",doSomethingDynamicish()); return 0; } staticlib.h: #ifndef __STATICLIB_H__ #define __STATICLIB_H__ int doSomethingDynamicish(); #endif staticlib.c: #include "staticlib.h" #include "dlfcn.h" #include "stdio.h" int doSomethingDynamicish() { void* handle = dlopen("./libdynlib.so",RTLD_NOW); if(!handle) { printf("could not dlopen: %s ",dlerror()); return 0; } typedef int(*dynamicfnc)(); dynamicfnc func = (dynamicfnc)dlsym(handle,"GetMeANumber"); const char* err = dlerror(); if(err) { printf("could not dlsym: %s ",err); return 0; } return func(); } dynlib.c: int GetMeANumber() { retur

Categories : C++

Android NDK/JNI: Build shared library using static library
Even though I can't put my hand on any related documentation, it seems to me that the LOCAL_EXPORT_C_INCLUDES should point to the folder instead of the file: LOCAL_EXPORT_C_INCLUDES := include It would seem logic, as this flag is an equivalent of the usual -I CFLAG, which would have been -Iinclude and not -Iinclude/myHeader.hpp Tell me if this solved your problem!

Categories : Android

Static library vs Dynamic library for storing classes
To me, this sounds like "the wrong place to split things". In other words, if your library needs a resource that is part of the application, then it's probably not meant to be a library in the first place - it is either a proper standalone DLL that contains its own resource, because it has a complete and standalone functionality, or it's actually part of the main executable, and uses the main executable's resource. The point of making something into a library is that it allows the separation of the library contents from the main application. Another option is of course that you pass in the relevant resource information from the main application to your class in the library [this works for a a DLL too, of course]. My point here is that a menu is something that belongs to the main appl

Categories : C++

How to trigger IBAction from UIButton in Storyboard static cell?
I realised that the UITableViewCell had User Interaction Enabled unchecked in the IB. This made any subviews inside it not interactive, thus the buttons not actually being pressed, and the IBAction not being called. Once I checked the box, everything worked fine.

Categories : IOS

Why does Ruby FFI not attach functions from custom shared object library
ffi is expecting a c function, so it's not finding your c++ functions because of the name mangling c++ does. You need to tell the linker to make the functions accessible from c, eg by doing (in your .h) file extern "C" { int add(int a, int b); } I suspect FFI also won't know what to do with a function that is expecting a std::string as a argument

Categories : C++

What does static library and dynamic link library mean to WP8?
At the basic level, static and dynamic libraries are the same as any other Windows environment (so see this other SO question for more clarification). For a WP8 app you will either need to produce: A XAML .NET/Windows Runtime hybrid app. A DirectX C++/C project (usually a game). For 1. you would need to wrap up either your static .lib or .dll in a WP8 Runtime component, for your .NET side to consume. For 2. it looks like you end up building a traditional .exe. In that case you would link directly to your .lib or .dll in the normal way. (I not so familiar with this one, so may be missing some subtleties here). In any case it's easier to link everything if you have all the source code in VS and reference the projects that build .lib or .dll you need, rather than the referencing the

Categories : Windows Phone 8

How to use a static library (e.g. cocoapods library) on a XCTest?
If you're using cocoapods, you can simply use link_with to include your test target, but if you're using a static library not created by cocoapods you can do the following: (I will still use a cocoapods library for the instructions, as that's what I'm working with, but the idea is the same if you're not using a cocoapods library) Once you have created a new Test Target, click on the project root node in the project navigator and select your test target. Go to Build Settings and search for Header Search Paths. Double click on the Header Search Paths item and enter ${SRCROOT}/Pods/Headers and select recursive if you want to import all of your cocoapods libraries headers or enter them individually: ${SRCROOT}/Pods/Headers/MagicalRecord leaving non-recursive selected (although in this case i

Categories : IOS

Add Tableview cell from a xib file in a static tablebview Controller which is being loaded from a storyboard
Register the nib with registerNib:forCellReuseIdentifier: (in viewDidLoad is a good place), and in your cellForRowAtIndexPath, dequeue a cell with the same identifier you passed in to that method when you want a cell of that type.

Categories : IOS

java.lang.NoSuchMethodError: android.app.FragmentTransaction.attach compatibility library v13 issue
Try this public android.support.v4.app.Fragment getItem(int position) { // TODO Auto-generated method stub switch (position) { default: return null; } } UPDATE check your import statements and replace this lines import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.app.FragmentActivity; Replace with this import android.support.v4.app.FragmentActivity; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction;

Categories : Android

How can I create a static library that links against another library and can be used by a third program that links both the libraries?
Is this possible? No, this simply can not be done with archive libraries (it can be done with shared libraries but requires great care to avoid symbol collisions).

Categories : Gcc

Static .lib required for compiling library is also required for library users?
Looks like you want partial linking (see --relocatable flag in ld manual page). As I can see from the sources, cabal uses partial linking only libraries, compiled for ghci. From Distribution.Simple.GHC (buildLib function): whenVanillaLib False $ do (arProg, _) <- requireProgram verbosity arProgram (withPrograms lbi) Ar.createArLibArchive verbosity arProg vanillaLibFilePath staticObjectFiles whenProfLib $ do (arProg, _) <- requireProgram verbosity arProgram (withPrograms lbi) Ar.createArLibArchive verbosity arProg profileLibFilePath profObjectFiles whenGHCiLib $ do (ldProg, _) <- requireProgram verbosity ldProgram (withPrograms lbi) Ld.combineObjectFiles verbosity ldProg ghciLibFilePath ghciObjFiles whenSharedLib False $ runGhcProg ghcSharedLinkArgs

Categories : Haskell

is system framework (like UIKIt.framework,CoreGraphics.framework) static library or dynamic library
It's a dynamic library. Frameworks are Apple's way of packaging up a particular version of a dynamic library, along with its dependencies (such as header files). See the Apple documentation for more information. It is not possible to use a framework intended for OS X for iOS. (although there is some overlap; Apple makes frameworks with the same names that do essentially the same thing for both platforms, with some possible differences.) They must be targeted for the iOS architecture you want to use them on.

Categories : Iphone

Can there be a C++ GUI Static library? But not a .dll?
You'll have to compile your GUI libraries into a static library. That doesn't have anything at all to do with console or non-console applications. Then, if you link your application with that, you get what you desire. But don't be surprised about the file size of your resulting program.

Categories : C++

Static library callback
Delegates are often communicated with by you declaring a protocol which specifies the set of callbacks. @protocol MONImageGeneratorObserver <NSObject> @required // called when an image has been generated - (void)generatedImageWasSavedToURL:(NSURL *)pURL; - (void)imageGenerationDidComplete; @end Then you can tell your client the interface they must implement by specifying the protocol in your APIs: - (void)setImageGeneratorObserver:(NSObject<MONImageGeneratorObserver>*)pObserver; Another good way to accomplish this is provide a parameter which is a block. You'll usually want to copy that block when you receive it. Then you don't need to know anything about the client's code. Your API should be very specific: that you copy it on which thread the block will be perform

Categories : Objective C

Do I need to add all the frameworks from my static library?
No, you must satisfy all the dependencies, framework or otherwise, of the static library. This is because a static library is a simple archive of object files, so you need to think of them as equivalent to the object files of your binary ("Project A" in your case).

Categories : IOS

Static Library import
You can include library by two ways either u can drag and drop library.xcodeproj into your project or you can include .lib file into your project. It might be possible that your lib file was not build properly. You could build ur lib file by opening ur library.xcodeproj in xcode select build target as iOS Device and build the project. If build is successful u could find the newly created .lib file to the following path LIbrary/Developer/Xcode/DerivedData now remove the previous lib file and include the new lib.

Categories : IOS

Compile a C++/SDL with static library?
dlls in windows are like .so in linux, they are made to be separate. If you want to merge a library, don't use dll, use static library instead (.lib) Edit: If you are not writing the library (somebody already gave you the dll), take a look at this

Categories : C++

How to build a static library in g++
Static libraries are not created through linking, rather they are simply an archive of the object (.o) files. make has built-in support for building static libraries: libdivmult.a: multiply.cpp divide.cpp (it's conventional to start the name of the static library with lib and use the file extension .a). Should be enough.

Categories : C++

Undefined Reference Using Static Library
You're building your app as a C++ app, it's possible you need to wrap your #include with extern "C", like so: extern "C" { #include <portal4.h> // other c-style headers here } Usually library authors manage this for themselves, but it's possible portal doesn't in this case?

Categories : C++

g++ the order of static library matters?
Yes, the order of libraries definitely matter. You need to put whatever uses the library first, then the library. I have had cases where library A depends on something in library B, and library B needs something in library A, so you then need to put library A twice in the list. The way the linker works is that it processes the object files, then reads the libraries to resolve the symbols not present in the object files. If the library has the object "files" to solve the dependency, then those parts are included. It then goes on to the next library. It doesn't "remember" what it has seen in the previous libraries.

Categories : C++

Errors when trying to build static library for iOS
SecIdentityRef and SecTrustRef are defined in the Security.framework. Make sure you are importing the proper header file: #import <Security/Security.h> and add the Security.framework to your project.

Categories : IOS

Use RestKit in static library and the project
If you know which version of RestKit the static library uses, you could just download the headers of that version in your project, and call its objects/methods normally. When building the project, if the other static library compiles internally the implementations of that library, when the linker should find the symbols.

Categories : IOS

Is it possible to link macfuse to a C++ static library?
You could provide a wrapper, exposing the C++ class as a C-API: Something.h: class Something { protected: int x; public: Something() { x = 0; } void setX(int newX) { x = newX; } int getX() const { return x; } }; wrapper.h: #pragma once typedef void *SOMETHING; #ifdef __cplusplus extern "C" { #endif SOMETHING createSomething(); void destroySomething(SOMETHING something); void setSomethingX(SOMETHING something, int x); int getSomethingX(SOMETHING something); #ifdef __cplusplus } // extern "C" #endif wrapper.cpp: #include <Something.h> #include "wrapper.h" SOMETHING createSomething() { return static_cast<SOMETHING>(new Something()); } void destroySomething(SOMETHING something) { delete static_cast<Something *>(something); } void setSo

Categories : C++

How do you link a C++ static library to a C program?
This isn't going to work, or at least is not going to be portable. The one really really obvious thing to do is to make your program C++ so you can access those features. You can't "natively" use C++ code from C code, for obvious reasons. You don't have access to object-oriented features, so a ton of stuff isn't going to work: constructors, destructors, move/copy semantics and virtual inheritance are probably the biggest things that you'll miss. (That's right: you won't be able to create or destroy objects correctly, unless they have trivial constructors and destructors.) You'll also run into linkage issues: C++ function names are mangled into a mess that includes their parameter types and return types and classes, which will look like __1cGstrcpy6Fpcpkc_0_. It would be technically feasi

Categories : C++

Linking non C99 static library in C99 mode
The order of the command line arguments matter. The way you have it now, the linker goes through your static libraries, realizes that nothing so far need anything it provides, and throw away everything in it. Do this: gcc -std=c99 -g -I../ -Llib/ test.c ../file1.c ../file2.c -lmylib -o test

Categories : C

Would you enable ARC for objective-c++ static library?
ARC is a compile-time feature, so if the library is designed to use ARC, you need to enable it when building the library. Otherwise, you can probably expect leaks. Whether it's Obj-C++ or Obj-C makes no real difference here.

Categories : IOS

static library used in lower version gcc
Note that there was never any official GCC 2.96 release: It has come to our attention that some GNU/Linux distributions are currently shipping with ``GCC 2.96''. We would like to point out that GCC 2.96 is not a formal GCC release nor will there ever be such a release. Rather, GCC 2.96 has been the code-name for our development branch that will eventually become GCC 3.0. GCC 3.0 was a major effort that involved an ABI change from GCC 2.95. Since "GCC 2.96" was based on snapshots of GCC 3.0 development, the ABI was probably in flux, and you are suffering the side-effect of using a development snapshot as a production compiler.

Categories : C++

Creating Static Library from a workspace
I have found the solution. You have to use the command: pod install --no-integrate when installing the pod. This will not create a workspace and allow the use of the script XCODEBUILD_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin XCODEBUILD=$XCODEBUILD_PATH/xcodebuild $XCODEBUILD -project T5Pusher.xcodeproj -target "T5Pusher" -sdk "iphoneos" - configuration "Release" clean build $XCODEBUILD -project T5Pusher.xcodeproj -target "T5Pusher" -sdk "iphonesimulator" - configuration "Release" clean build lipo -create -output "build/libT5Pusher.a" "build/Release-iphoneos/libT5Pusher.a" "build/Release-iphonesimulator/libT5Pusher.a" Then to set the config file for pods: -Go to project editor -> info -> configuration -Set the target to use pods.xconfig file for debug and rel

Categories : IOS

iOS - Is there any way of getting a Low Memory Warning in a Static Library?
Observing UIApplicationDidReceiveMemoryWarningNotification is the correct approach for you to take. You will need to import the UIApplication.h file in order to (safely) complete your library. If you're compiling for multiple architectures (iOS & OS X) then you can put conditional sections into your code so that the import isn't included when it isn't appropriate. You can also weak link UIKit.

Categories : IOS

Building a c based static library for iOS
You want to cross-compile libcurl for iOS but the problem here is that you use clang which by default produces 64-bit x86_64 object files. In other words you need to work with the iOS toolchain (xcrun -sdk iphoneos clang), provide the right architecture flag(s)[1] (e.g -arch armv7) and use the right sysroot path. I recommend you to refer to: curl-ios-build-scripts: a collection of handy scripts used to build (lib)curl for iOS 5+ and OSX 10.7+, or, http://seiryu.home.comcast.net/~seiryu/libcurl-ios.html which provides a ready-to-use a precompiled binary. [1]: you may want to produce a fat library that targets ARMv7, ARMv7s and i386 (simulator) architectures.

Categories : IOS

Issue with accessing static from outside c++ library
I think you may be a bit confused about what static does. When you declare a global static variable within a compilation unit (usually a cpp file), this means that that variable is local to the compilation unit and cannot be seen elsewhere. Since you are declaring a global static variable within a header file that gets included in two separate cpp files, this ultimately leads to two very different (compilation unit local) global variables named world. However, the world variable created within b2GLPolygonShape.cpp has nothing to do with the variable created in JNIBox2DWorld.cpp. What you probably wanted to do is to declare an external variable in your header file: example.h extern b2World* world; and in one, but only one(!), cpp file create the object: example.cpp b2World* world =

Categories : C++

Static -libgfortran in library build
-dynamiclib -lgfortran -static-libgfortran /opt/local/lib/gcc47/libquadmath.a -static-libgcc seems to do the trick! The bizarre thing was figuring out that I needed to add a full path to the libquadmath.a, which feels like a bug with gcc/gfortran to be honest.

Categories : Gcc

Any way to compile the firebreath as static library?
All the libraries are statically linked to generate the plugin. The project generated by fbgen.py compiles into static libraries from the source which are then linked to for the plugin. You just have to keep your source files for the plugin with you. You can generate the project anywhere you want using the prep** scripts.

Categories : Osx



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.