Swift - C++ string via C API

Swift
I have Swift with bridge to C API I wan to do something like this: const char * CApiFunc(){ std::string str = "some_str"; return str.c_str(...
3 years ago

code optimization in C and C++

C
Is there any optimization between the following two code snippets? case 1: int func() { int a = 10; return a; } The first case assigns a v...
3 years ago

Call C++ dll in c# code

C++
I am trying to call a C++ dll in C# code. my header file - #define MLTtest __declspec(dllexport) class MLTtest testBuilder { public: testBuilder...
3 years ago

C# equivalent to C++ friend keyword?

C#
I am new to C#, and I have a problem for which in C++ I would normally use the friend identifier. Now I know the friend keyword doesn't exist in C#, b...
3 years ago

C/C++ program without header files

C
I was wondering if there is any possible way to write C/C++ program without using header files at all. #include <iostream.h> //I want this sam...
3 years ago

Using/Mixing C in C++ code?

C
Is using C in C++ bad? Many people have told me that using C in C++ is bad because it's not as safe, and it requires more memory management. I keep t...
3 years ago

String for C# from C++ COM

C#
I have a C++ DLL and some functions return Unicode null-terminated strings: void SomeFunc(wchar_t* StrBuf) The caller must allocate StrBuf - string...
3 years ago

Works in C, but not in C++

C
The following code compiles in C but not in C++: int *ptr = 25; //why not in C++? Error prog.cpp: In function ‘int main()’: prog.cpp:6:11: error:...
3 years ago

How to seek in FFmpeg C/C++

C
Does anyone know how to implement seeking by seconds (or milliseconds) in FFmpeg. I currently have a loop running through the frames of a video using ...
3 years ago

C++ DLL from C# returns -858993460

C#
I have a C++ (MSVS 2010) DLL from the samples MS give as: namespace MathLibrary { double Functions::Add(double a, double b) { ...
3 years ago

C/C++ maximum stack size of program

C++
I want to do DFS on a 100 X 100 array. (Say elements of array represents graph nodes) So assuming worst case, depth of recursive function calls can go...
3 years ago

simulation algorithm implementation in C/C++

C
Let a row of 8000 lamps. Initially, only the one located to the left is lit. Then, every second, the following operation is performed: each lamp chang...
3 years ago

Loading a C++ DLL in C#

C#
I am trying to use a DLL that was writen in C++ but my application is in C# The DLL is from another company but they have supplied an SDK for their s...
3 years ago

How much faster is C++ than C#?

C#
Or is it now the other way around? From what I've heard there are some areas in which C# proves to be faster than C++, but I've never had the guts to...
4 years ago

Differences between Pthread in C vs C++

C
So I was able to pass an Ada function using Ada_function'Address to a C_function. Here is the C function: void Create_Process(int * status, void * f...
4 years ago

C/C++ with Android Studio version 2.2

C
With Android Studio 2.2, and the new C++ support they added; can I now write and compile inside android studio, or do I need to compile and import my ...
4 years ago

Explicit type casting operator in C/C++

C
The following code converts the float type 7.5 to an integer value 7, the remainder is lost. Here, the typecasting operator is int. I know it is vali...
4 years ago

sizeof a union in C/C++

C
What is the sizeof the union in C/C++? Is it the sizeof the largest datatype inside it? If so, how does the compiler calculate how to move the stack p...
4 years ago

C++ Mutex replacement in C sharp

C#
I have a project which is written in C++ which has functionality of file copy and folder creations. It uses the Mutex.Lock() and Mutex.unLock() method...
4 years ago

Does Arduino use C or C++?

C
Coming from Python, the whole C/C++ thing is kind of alien to begin with... and then I see in one place that Arduino uses 'standard' C, and in another...
4 years ago