abi

std::type_info::hash_code() uniqueness and the meaning of “should”

余生长醉 提交于 2020-01-02 01:18:27
问题 Is it meant to be guaranteed that same std::type_info::hash_code() values imply same types? Cplusplus.com seems to claim so: This function returns the same value for any two type_info objects that compare equal, and different values for distinct types that do not. [Emphasis mine] Cppreference seems to claim otherwise: Returns an unspecified value, which is identical for objects, referring to the same type. No other guarantees are given , in particular, the value can change between invocations

Visual Studio C++ dll library crashes in Qt application

冷暖自知 提交于 2020-01-01 08:53:27
问题 I have a problem sharing "std::string" data between MS Visual C++ DLL library and Qt program. What I have are: DLL library written in Visual C++ 2010 Express, which exports one method: extern "C" __declspec(dllexport) int Init(ITest* commandTest); Abstract interface "ITest" and a class implementing it: class CTest: public ITest { public: CTest(); virtual ~CTest(); virtual void getVersion(std::string & version) const; }; Qt GUI application that needs to: * load the DLL dynamically *

X86-64 NASM calling extern c functions

…衆ロ難τιáo~ 提交于 2019-12-31 07:54:26
问题 Im very new to assembly but know a bit of c. Im playing around with extern function calls like extern _printf str db "Hello", 0 push str call _printf but cant find any tutorials using extern functions except scanf and printf. For example strcmp? How can i call strcmp in my case? 回答1: Here is my answer. It is specific to x86-64 though. Please know that when pushing arguments to a function, you usually place the first 6 in registers rdi , rsi , rdx , rcx , r8 , and r9 . The rest get pushed to

X86-64 NASM calling extern c functions

混江龙づ霸主 提交于 2019-12-31 07:54:04
问题 Im very new to assembly but know a bit of c. Im playing around with extern function calls like extern _printf str db "Hello", 0 push str call _printf but cant find any tutorials using extern functions except scanf and printf. For example strcmp? How can i call strcmp in my case? 回答1: Here is my answer. It is specific to x86-64 though. Please know that when pushing arguments to a function, you usually place the first 6 in registers rdi , rsi , rdx , rcx , r8 , and r9 . The rest get pushed to

Library ABI compatibility between versions of Visual Studio

别来无恙 提交于 2019-12-30 06:01:11
问题 I have two scenarios. Suppose I have 3 shared libraries that export C++ symbols, each built with VS7.1, VS8, and VS9. I compile all 3 in VS9. For some reason, this works. I do not need to recompile the first 2 libraries in VS9 for VS9 linker to successfully find the symbols and link against them. Now, if I have a library that only exports symbols using C syntax (extern "C"), is this the same? I've heard people say that the ABI for C is standardized, so there is somewhat of a guarantee that

How to optimize function return values in C and C++ on x86-64?

馋奶兔 提交于 2019-12-29 06:43:20
问题 The x86-64 ABI specifies two return registers: rax and rdx , both 64-bits (8 bytes) in size. Assuming that x86-64 is the only targeted platform, which of these two functions: uint64_t f(uint64_t * const secondReturnValue) { /* Calculate a and b. */ *secondReturnValue = b; return a; } std::pair<uint64_t, uint64_t> g() { /* Calculate a and b, same as in f() above. */ return { a, b }; } would yield better performance, given the current state of C/C++ compilers targeting x86-64? Are there any

How do vararg functions find out the number of arguments in machine code?

心已入冬 提交于 2019-12-28 06:02:25
问题 How can variadic functions like printf find out the number of arguments they got? The amount of arguments obviously isn't passed as a (hidden) parameter (see a call to printf in asm example here). What's the trick? 回答1: The trick is that you tell them somehow else. For printf you have to supply a format string which even contains type information (which might be incorrect though). The way to supply this information is mainly user-contract and often error-prone. As for calling conventions:

Is it possible to get the function name from the mangled string

送分小仙女□ 提交于 2019-12-25 18:24:48
问题 This question is a continuation of the following question, where a code to demangle a function-name given by the backtrace function is presented. I wonder whether there is a way to get the name and the namespaces of a callable object . Here we assume that the function does have a name and that it is possible to demangle its name with abi::__cxa_demangle (for example, it's not a lambda function). Furthermore, would it be possible to get a list of the namespaces in which the function is? 来源:

android : how can i build my application that work on devices with Intel CPU?

不问归期 提交于 2019-12-24 22:57:19
问题 how can i build my application that work on devices with Intel CPU ? my application work on devices with arm technology but when i try to install my app on device with Intel CPU it`s show this message : Devicenot compatible and this message on log : Failure [INSTALL_FAILED_CPU_ABI_INCOMPATIBLE] this is my project build.gradle file : apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.test.test" minSdkVersion 16

Generating Multiple Apk according to the Native ABI

给你一囗甜甜゛ 提交于 2019-12-24 08:03:17
问题 I am building release apk based on the ABI because of apk size to publish on Play store . So I started apk building for ABI = armeabi-v7a then building ABI = x86 and ABI = areambi so my gradle look like this app gradle android { compileSdkVersion 26 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.package" minSdkVersion 18 targetSdkVersion 26 versionCode 1 versionName "1.0" multiDexEnabled true ndk { abiFilters "armeabi-v7a" } } buildTypes { release { minifyEnabled false