dll

C++ Callback to send text back to C#

丶灬走出姿态 提交于 2019-12-30 05:26:07
问题 I'm new to C++. I have been told using a "callback" with C++ is the best solution for this. Here is my situation. I have a DLL written in C++ this DLL has a method to start the service which is run via the C# code (this works fine) when the service in the DLL runs I want the DLL to pass back text to the C# code, this is just progress code such as "stage one starting " and "stage one completed" I have looked around and been told that the best way to achieve this is to use callbacks, I don't

ASLR and Windows System DLLs for non-aware executables?

醉酒当歌 提交于 2019-12-30 05:22:09
问题 From a Microsoft article: Address Space Layout Randomization (ASLR) ASLR moves executable images into random locations when a system boots, making it harder for exploit code to operate predictably. For a component to support ASLR, all components that it loads must also support ASLR. For example, if A.exe consumes B.dll and C.dll, all three must support ASLR. By default, Windows Vista and later will randomize system DLLs and EXEs , but DLLs and EXEs created by ISVs must opt in to support ASLR

Problem with loading compiled c code in R x64 using dyn.load

旧巷老猫 提交于 2019-12-30 04:40:09
问题 I recently went from a 32bit laptop to a 64bit desktop (both win7). I just found out that I get an error now when loading dll's using dyn.load . I guess this is a simple mistake and I am overlooking something. For example, I write this simple c function (foo.c): void foo( int *x) {*x = *x + 1;} Then compile it in command prompt: R CMD SHLIB foo.c Then in 32bit R I can use it in R: > dyn.load("foo.dll") > .C("foo",as.integer(1)) [[1]] [1] 2 but in 64bit R I get: > dyn.load("foo.dll") Error in

Calling functions from a c++ DLL in Delphi

纵饮孤独 提交于 2019-12-30 04:02:33
问题 I created a new c++ DLL project in VS2010 that exposes 1 function #include "stdafx.h" #define DllImport extern "C" __declspec( dllimport ) #define DllExport extern "C" __declspec( dllexport ) DllExport int DoMath( int a, int b) { return a + b ; } I then created a C++ application with VS2010 to test this DLL. The test application build in VS2010 could call the c++ DLL and get the expected result. #include "stdafx.h" #include <windows.h> typedef int (*DoMath)(int, int) ; int _tmain(int argc,

Settings.Default.<property> always returns default value instead of value in persistant storage (XML file)

£可爱£侵袭症+ 提交于 2019-12-30 03:12:28
问题 I recently wrote a DLL in C# (.Net 2.0) which contains a class that requires an IP address. A co-worker of mine altered the class to retrieve the IP from a ".dll.config" (XML) file -- This apparently is automatically generated by the "Application Settings" file he created (Settings1.settings). The benefit of this was to allow the end-user to change the IP address in the XML/config file at will. Unfortunately, when I check his code out of the tree and try to compile (or use) this new code, any

How do I export class functions, but not the entire class in a DLL

别等时光非礼了梦想. 提交于 2019-12-30 02:26:05
问题 I have developed a Win32 DLL, providing the details below, and want to create a CLI/C++ wrapper for the functions Connnect and LogOut. I know that entire classes and functions can be exported from a DLL. class CClientLib { public: CClientLib (void); // TODO: add your methods here. __declspec(dllexport) bool Connect(char* strAccountUID,char* strAccountPWD); __declspec(dllexport) void LogOut(); private : Account::Ref UserAccount ; void set_ActiveAccount(Account::Ref act) { // Set the active

How to pass pointer back in ctypes?

扶醉桌前 提交于 2019-12-30 02:21:28
问题 Don't know much about ctypes, just recently began working with it. I have a simple function in C-like dll which returns a pointer to the dynamically generated string. It is working fine, but, because i manually allocated memory for the string, i should free it after use. I have something like this: extern "C" char* DLL_EXPORT func(const char* str1, const char* str2) { return getSomeString(str1, str2); } // Goal is to call this function correctly from Python. extern "C" void DLL_EXPORT freeMem

Restrict access to .NET assembly?

依然范特西╮ 提交于 2019-12-30 01:23:04
问题 Is there a way to have a .NET assembly accessible for only authorized sources? I mean I want to have a DLL that contains components, but I don't want anyone to be able to use these components but the other DLLs EXEs in my solution. I do want them to be in separated DLLs though. Restriction on namespace might also be a good idea if this feature exists out there. Is there a way? 回答1: You can create internal classes. And the give your specified assemblies to access these classes by using

list exported functions from dll with ctypes

隐身守侯 提交于 2019-12-30 00:31:26
问题 Is there any way to know which functions are exported from the dll through python foreign function library ctypes ? And if possible to know details about the exported functions through c types . If yes, could someone provide a snippet of code? 回答1: I don't think ctypes offers this functionality. On Windows with visual studio: DUMPBIN -EXPORTS XXX.DLL Or for mingw on windows: objdump -p XXX.dll 回答2: If you are on Linux, there is a handy utility nm to list the content of a shared library (there

Linking GMP to Xcode 4.5

空扰寡人 提交于 2019-12-29 09:39:08
问题 I've downloaded the GMP multiprecision library and I compiled without errors the following code through the terminal with the gcc main.c -lgmp command but I can't figure out how to include the GMP library in XCode 4.5 because the howtos online are a bit confusing. I really need to use the GMP library for my projects and any comment would be great help. #include <stdio.h> #include <gmp.h> int main(int argc, const char * argv[]) { printf("Hello, World!\n"); mpz_t a; return 0; } 回答1: (Answered