How to run some code compiled in DLL on GPU - visual-c++

I have program written in C++ and compiled as DLL and theres some code in my program that's difficult to compute on CPU so I wanna run it on GPU instead, is it somehow possible ? I don't know if I will have to rewrite my entire project because of CUDA or other toolkits.
Also my program must be in DLL not EXE

Related

VLD causes issues

ALL,
I have MSVC 2017 Community and trying to find where is the memory leak in my program.
I did compile and link against the VLD and I did copy vld_x86.dll, dbghelp.dll and Microsoft.DTfW.DHL.manifest to the same place where executable is.
Trying to run the program under MSVC I am getting
wntdll.pdb not loaded
exception.
If I build without VLD, program starts without any issues.
What is a way to debug memory leaks with MSVC?
TIA!!

Solving heap management differences in EXCEL and CYGWIN-DLL´s

I am trying to use a sample IPOPT problem written in C and compiled as a DLL which is used in EXCEL VBA code.
I am using Cygwin to compile the DLL in Windows. (As stand allone EXE, it works propperly as expected).
From EXCEL, I can access the DLL without problems and can exchange data.
However, as soon as the DLL starts to run IPOPT functions, EXCEL closes with Errors.
From my Debugging activities, this results from memory allocaction.
If the C code in the DLL tries to allocate memory using malloc, EXCEL will run into ERRORS.
If the C code in the DLL allocates memory via the functions LocalAlloc (from windows.h) instead, everything works properly.
Now, I would obviously need to change the malloc calls in whole IPOPT code (and maybe BLAS, LAPACK and the solvers?) from malloc to
LocalAlloc.
Is there a pain - free way to do that? Any chance for a wrapper or any way to make EXCEL to accept the heap management of the C-DLL created by Cygwin?
Any configuration options?
Thank you for any help!

is there any GUI tool to view compiled file with source code?

for example, i've got a uboot copy and compiled it with a target platform. but i dont have the hardware and debug tool to run the step by step debug.
so, I wonder is there a GUI tool(win/linux) can load these source and elf file ,then i can read the 'compiled c code'.
Use IDA PRO + Hex-Rays decompiler.
Additionally one can use Ghidra. It also is equipped with decompiler.
It will give you not the exact C program but what it would try to do to reconstruct C source from the assembly. It is actually not that bad in doing that but it's not a cheap solution.
You can run objdump -d -M intel path/to/CompiledCprogram in the terminal window to read the compiled program in assembly code from the main: section in the assembly code.
Other than that, you may not able to do much about an already compiled C program.

Why would Eclipse C ndk jni execution speed be 6 times slower than gcc shell?

I have a program which uses C ndk subroutines in jni which processes a 3204x2406 image file which takes 6+ seconds when run *(without debug) by eclipse with NDK_DEBUG=0.
I've got the same code compiled with GCC on the android running in the shell at under 1 second.
The code consists of loops and integer math. Both the eclipse ndk program and the gcc shell program access the exact same file from the exact same location. There are no trace statements within the 6 seconds. The only external calls is 2406 read statements.
The eclipse is the google integrated download 21.0.0, which is uses Juno 4.2.1 and c/c++ 8.1.1. And yes, i've restarted eclipse and cleaned the project.
I'm now thinking about trying to call or link to the GCC code, but keep feeling like I must be missing something silly.

MSVC 2010 - Error 0xc000007b when building in x64

The title is pretty straightforward - I can't get anything at all to run when building in x64 and I get a message box with this error code. Do you know what may be the problem here?
This is STATUS_INVALID_IMAGE_FORMAT, you can find these error codes listed in the ntstatus.h SDK header file.
It is certainly strongly correlated with building x64 code. You'll get this status code whenever your program has a dependency on 32-bit code, particularly in a DLL. Your program will fail to start when it tries to load the DLL at startup, a 64-bit process cannot contain any 32-bit code. Or the other way around, a 32-bit process trying to load a 64-bit DLL.
Review all the dependencies for your program, particularly the import libraries you link. Everything must be built to target x64. You can use SysInternals' ProcMon utility to find the DLL that fails to load, useful in case this is a DLL Hell problem.
Just an addition to the correct answer above: also check you .manifest-files (resp. #pragma comment(linker,"/manifestdependency...) and make sure that you have processorArchitecture='x86' for 32-bit and processorArchitecture='amd64' for x64 code.

Resources