天道酬勤,学无止境

dll

C# program and C++ DLL compiled for 32-bit system crash on 64-bit system

I have a C# application that makes use of a DLL as I need C++ to access some unmanaged functionalities of the user32 API (I cannot use PInvoke for that). I compile both the application and the DLL for x86 architectures, and everything works fine on Windows 7 32 bits. Now the problem is, on Windows 7 64 bits, the application crashes when I try to use the feature that relies on the DLL (but all the rest works fine). I suspect that this is a 32/64 bits issue, so I tried re-compiling the DLL for x64 architectures, and now I can choose at runtime which DLL to load between the x86 and the x64. But

2022-01-19 00:09:50    分类:问答    c#   c++   windows   dll   32bit-64bit

Embedding .dlls - Assembly resolving in C#

I have a .dll I'm trying to embed as a resource inside an executable. The following two questions are somewhat helpful, but are not a full help: Embedding assemblies inside another assembly This doesn't seem to work as written; the args.Name cannot be used as written, but even if it's fixed, the program still complains of a missing .dll, indicating that the assembly is not properly loaded. Embedding DLLs in a compiled executable and the link in one of the answers of: http://codeblog.larsholm.net/2011/06/embed-dlls-easily-in-a-net-assembly/ However, there is no "App.xaml*" file in my project of

2022-01-19 00:02:41    分类:问答    c#   dll   embedded-resource

Use log4net in SDK

I am providing an SDK using C#. To enable field debugging, I want to include logging using log4net. How to enable configuration without using App.config since the assembly will be a dll? Thanks,

2022-01-18 17:28:06    分类:问答    c#   dll   sdk   log4net

Populate C# struct using Mupen64Plus Unmanaged C dll API command

I'm using Mupen64Plus and the included m64p_test_rom.v64 file. I'm using C# to talk to the mupen64plus.dll API which is written in C. Problem I'm trying to use its API command M64CMD_ROM_GET_HEADER to get the ROM Header from m64p_test_rom.v64, which contains properties like Name, Manufacturer ID, Country code. It looks like the command stores the data in a struct. The problem is that when the API command is called to populate the struct, the variables remain null, it does not populate it with new values. API I'm using this C# API code from BizHawk to talk to mupen64plus.dll. Commands

2022-01-18 15:41:09    分类:问答    c#   c   struct   dll   unmanaged

LoadLibraryW() failing to load DLL in System32

I'm trying to load a DLL that was installed with a printer driver in the C:\Windows\System32\ folder with the following code: LoadLibraryW(L"C:\\Windows\\System32\\MagAPI.dll"); GetLastError() is reporting that "The specified module could not be found". If I move the DLL outside of the System32 folder (C:\SomeFolder\MagAPI.dll for example) then it will load fine so it doesn't seem like it's a problem with the DLL itself. Is there some weird Windows security feature that might be blocking my application from loading it? That's the only thing I can think of but I can't find any definitive

2022-01-18 12:06:44    分类:问答    c++   dll   loadlibrary   system32

Visual C++ Release build - is string getting corrupted when passed across DLL because compiled with different runtime version?

After building in Release mode, I am seeing exceptions which didn't occur in Debug mode. When debugging the release build, it looks like string references are not being passed correctly from the EXE (our application) to the DLL which is receiving the string reference. Our EXE code looks like this: string contents = "handle_message(): received=" + msg->encode(); LOG4CXX_DEBUG(logger, contents); The LOG4CXX_DEBUG is going to log4cxx.dll, whose code looks like this: CharMessageBuffer& CharMessageBuffer::operator<<(const std::basic_string<char>& msg) { if (stream == 0) { buf.append(msg); } else {

2022-01-18 10:25:35    分类:问答    visual-c++   dll   corruption

Is the '-1 month' in SQLite DATETIME function 'broken'?

When using the DATETIME function to do some arithmetic, I've found the following behaviour: select DATETIME('now', '-1 month', 'start of month') expected: 2011-02-01 00:00:0 result: 2011-03-01 00:00:0 - Fail select DATETIME('now', '-2 month', 'start of month') expected: 2011-01-01 00:00:0 result: 2011-01-01 00:00:0 - Ok This only appears to be happening since yesterday, my integration tests picked up on this. My guess is that the month that is substracted is calculated in days and that somehow the number of days in the last full month is used (not the current). The last full month, february

2022-01-18 09:39:15    分类:问答    sqlite   datetime   dll

c++, multiple instances of a dll, singleton

I have got a DLL in which a singleton is defined. I have got an app which can load multiple instances of this DLL. The DLL needs a singleton instance per DLL instance, otherwise it will crash. I observed that there was only one singleton instance for multiple DLL instances. Why? How can I resolved it (if possible, without refactoring the singleton into something else)? Thanks for any help.

2022-01-18 07:45:43    分类:问答    c++   dll   singleton   multiple-instances

Can a C++ dll file be loaded in Lua?

I need to load a DLL file in Lua to connect different APIs. I know that C type dlls can be loaded, but what I have is a dll file produced in C++. The code (in C++) that produced this library was of the form: // MyAPI.h namespace MyAPI { public class MyFirstClass { public: MyFirstClass(); void performSomeMethod(int arg); } } which then produced the dll file MyAPI.dll. When I now try to import this in Lua, using: require "MyAPI" it immediately gives the error: error loading module 'MyAPI' from file '.\MyAPI.dll': The specified procedure could not be found. I do not understand what this means, or

2022-01-18 06:38:11    分类:问答    c++   dll   lua

The application is in break mode. your app has entered a break state,

I found myself in this same problem than here, I'm using windows forms in a dll (this is for an Autocad plug-in) and I cannot debug my code because I receive "The application is in break mode. your app has entered a break state, but no code is currently executing that is supported by the selected debug engine". I have tried every recommendation in this list and none worked for me. One odd thing was that I can break in the constructor but the events that use a controller/config object get that page. Any ideas why this may be happening? thanks in advance

2022-01-18 06:31:35    分类:问答    c#   .net   dll   autocad