dllexport

Unresolved external symbol

ぃ、小莉子 提交于 2019-12-11 09:52:19
问题 I have two WIN32 DLL projects in the solution, main.dll should call a function in mgn.dll. mgn.dll has mgn.h header file: #ifdef MGN_EXPORTS #define MGN_API __declspec(dllexport) #else #define MGN_API __declspec(dllimport) #endif extern "C" bool MGN_API AttachMGN(void); and mgn.cpp source file: #include "stdafx.h" #include "mgn.h" MGN_API bool AttachMGN(void) { ... } main.dll calls AttachMGN function from one of the source file: #include "stdafx.h" #include "..\mgn\mgn.h" bool CreateClient()

Load DLL exported data dynamically

南楼画角 提交于 2019-12-11 08:49:13
问题 Is there a version of GetProcAddress for exported data? I would like to do something like: Mydll.cpp: MyDataType::MyDataType(long, wchar_t*) { //Dummy code this->temp = 3; } __declspec(dllexport) MyDataType Here(50, L"random text"); MyClient.cpp: int main(void) { HINSTANCE hData = LoadLibrary("MyDll.dll"); reinterpret_cast<MyDataType*>(GetDataAddress(hData, "Here"))->DoSomething(); } That is, define an exported data ("Here") of UDT ("MyDataType"), and them obtain its address when the DLL is

MSVC unresolved external symbol linking executables

好久不见. 提交于 2019-12-11 07:24:58
问题 I have two existing executables A and T, in the same solution that both ran just fine before I touched them. In executable A is a header defining a class P, and a prototype for a static instance MyP. The definitions are compiled in project A. In executable T, I wanted to call member functions of MyP in project A, so I added dllimport/export macros to the declarations of the class and MyP in the headers (not at the definitions), and included the headers in project T. The dllimport/export

Passing Images to opencv from unity

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 06:47:10
问题 I've created a dll to pass two images from unity to opencv and return a struct. But I'm getting a run time c++ error. This is the code I used in C++: struct rigidTransform { rigidTransform(double eular_angle_x, double eular_angle_y, double eular_angle_z, double eular_dis_x, double eular_dis_y, double eular_dis_z) : Eular_angle_x(eular_angle_x), Eular_angle_y(eular_angle_y), Eular_angle_z(eular_angle_z), Eular_dis_x(eular_dis_x), Eular_dis_y(eular_dis_y), Eular_dis_z(eular_dis_z) {} double

DUMPBIN utility mangled name output

眉间皱痕 提交于 2019-12-10 15:20:58
问题 I am using DUMPBIN utility for getting mangled name from a c++ dll to use in a c# application . I am exposing a c++ class member function using __declspec(dllexport) and the output mangled name result is the folowing ?InitPort@CProtocolStack@@QAEEHEPAEKE@Z = ?InitPort@CProtocolStack@@QAEEHEPAEKE@Z (public: unsigned char __thiscall CProtocolStack::InitPort(int,unsigned char,unsigned char *,unsigned long,unsigned char)) Do I need to use the whole name in C# application while importing the same

Is there an alternative linker to link.exe?

て烟熏妆下的殇ゞ 提交于 2019-12-08 07:54:50
问题 I'm working on a proxy DLL and would like to export symbols with an "@" character in them. However, it appears that this character has a special meaning to link.exe (actually, to lib.exe, I guess?). Given a C++ file extern "C" void f() { } I can create a DLL which exports f as foo by running cl /LD exports.cpp /link /export:foo=f but as soon as the alias contains the "@" character, everything after it (including the "@" itself) appears to get stripped, i.e. all of the following export the

Unhandled Exception: System.AccessViolationException: Attempted to read or write

旧时模样 提交于 2019-12-08 05:12:55
问题 Below is my c++ DLL // DLL.cpp : Defines the exported functions for the DLL application. #include "stdafx.h" //#include <stdexcept> #include<iostream> using namespace std; typedef void (*FunctionPtr)(int); void (*FunctionPtr1)(int); extern "C" __declspec(dllexport)void Caller(); extern "C" __declspec(dllexport)void RegisterFunction(FunctionPtr func_ptr); extern void Caller() { int i = 10; FunctionPtr1(i); } extern void RegisterFunction(FunctionPtr func_ptr1) { FunctionPtr1 = func_ptr1; } This

Using a C# DLL in Delphi only uses the first function parameter

拟墨画扇 提交于 2019-12-08 03:52:41
问题 I use C# DLL Export (UnmanagedExports - https://www.nuget.org/packages/UnmanagedExports) to make my managed C# DLL Accessible to unmanged Code like Delphi. My problem is that only first function parameter is transfered from delphi to the C# dll: The C# DLL Part [DllExport("SomeCall", CallingConvention.StdCall)] public static String SomeCall([MarshalAs(UnmanagedType.LPWStr)] String data1, [MarshalAs(UnmanagedType.LPWStr)] String data2) { //Data1 is never filled with some string data. String

Correct way to export a DLL function on Mac OSX

心已入冬 提交于 2019-12-06 15:55:43
I'm trying to compile a simple DLL on a Mac OS X 10.6, and am confused about the proper way to declare a function that the DLL offers up for the world to use. Following sample code from a reliable source, I came up with: __declspsec(dllexport) pascal int ReturnTheNumberFive(void) but gcc barfs on it. What the sample code actually had was MACPASCAL and DLLExport, which I assumed were macros. I grepped through the sample codes, SDKs, etc for #defines and plugged in what I found. These definitions could have been buried inside #ifs, so what I found isn't good and true. Illogically, the compiler

how to use an exported class (__declspec(dllexport))in an stl template?

耗尽温柔 提交于 2019-12-06 05:33:04
问题 I am using an exported class class __declspec(dllexport) myclass { private: template __declspec(dllexport) class std::map<myclass*,int>; std::map<myclass*,int>m_map; //something }; When I do this, I get a warning C4251 saying m_map:class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class myclass. Any ideas about how i can resolve this ? Atul 回答1: You should not be using __declspec(dllexport) into the header files that code using your DLL will be using, as they