dllimport

Use a dll from a c++ program. (borland c++ builder and in general)

风流意气都作罢 提交于 2020-01-15 05:26:10
问题 I'm trying to use a dll, namely libcurl, with my program, but, it's not linking. Libcurl comes with .h files that I can include (takes care of dllimport), but then I guess I must specify which dll to actually use when linking somehow... How do I do that? I'm compiling with Borland C++ builder, but I really want to know how these things work in general... EDIT: This is the code (straight c/p from curl homepage) bool FTPGetFile::ConnectToFTP(string ftpServer){ CURL *curl; CURLcode res; curl =

Calling C++ function using DllImport

冷暖自知 提交于 2020-01-15 03:32:05
问题 This one is basic, how do I call the function SubscribeNewsFeed in the following from a C# DllImport? class LogAppender : public L_Append { public: LogAppender() : outfile("TestLog.txt", std::ios::trunc | std::ios::out) , feedSubscribed(false) { outfile.setf(0, std::ios::floatfield); outfile.precision(4); } void SubscribeNewsFeed() { someOtherCalls(); } }; I'm unable to figure out how to include the class name when using the DllImport in my C# program here: class Program { [DllImport(

Obtain a filename from a file handle?

我怕爱的太早我们不能终老 提交于 2020-01-14 10:24:47
问题 I have the ntdll.dll's NtCreateFile() function hooked to allow/deny the access of certain files. Unlike kernel32.dll's CreateFile() which easily gives you the full path to the file in question, ntdll.dll's NtCreateFile() function only gives you the handle to the file. I need to obtain the full path of the file from a file handle, to consequently allow/deny access. I've searched around and there doesn't seem to be a working C# solution. This solution is in C++, and documented from Microsoft. I

Obtain a filename from a file handle?

给你一囗甜甜゛ 提交于 2020-01-14 10:23:26
问题 I have the ntdll.dll's NtCreateFile() function hooked to allow/deny the access of certain files. Unlike kernel32.dll's CreateFile() which easily gives you the full path to the file in question, ntdll.dll's NtCreateFile() function only gives you the handle to the file. I need to obtain the full path of the file from a file handle, to consequently allow/deny access. I've searched around and there doesn't seem to be a working C# solution. This solution is in C++, and documented from Microsoft. I

How do I import MySql Connector into Unity Project?

无人久伴 提交于 2020-01-14 03:28:28
问题 I've tried placing the basic dll's into unity's assets folder - Result: "blah blah will cause Unity to Crash Error." I've tried Manually adding references - Result: Unity refreshes its references anytime the editor refreshes, so worthless. I've tried Installing using NuGet - Result: Closest to success as it handles all the dependencies and whatnot but I get: Assets/Scripts/Developing/TalkToDB.cs(3,7): error CS0246: The type or namespace name `MySql' could not be found. Are you missing an

DllImport vs LoadLibrary, What is the best way?

爱⌒轻易说出口 提交于 2020-01-11 09:41:08
问题 i'm usually using Win32 API in c#.NET. But not declare all in one application. Sometimes usually using user32, sometimes gdi32 ... I think when i declare all api function, those use lot of memory. What is the best way using API in .NET ? 回答1: Most of the Win32 API is available through managed abstractions. Otherwise, declare the ones you need using DllImport . LoadLibrary should really only be used where you have provided alternate functionality, that is, your application can work even

C# DllImport library written on C++

不羁岁月 提交于 2020-01-11 07:52:37
问题 I'm pretty new in C#. I have Dll written on C++ by myself and I'm going to use functions from that dll in C# app. So, I do the following when declare functions in C++ project: public static __declspec(dllexport) int captureCamera(int& captureId); Then I'm trying to import this method in C# app: [DllImport("MyLib.dll")] public static extern int captureCamera(ref int captureId); But I have the exception: Unable to find an entry point named 'captureCamera' in DLL 'MyLib.dll'. The task is to do

“The specified procedure could not be found” error with .NET 4

China☆狼群 提交于 2020-01-11 03:15:07
问题 I am developing on a 64-bit Windows 7 box with Visual Studio 2012 (11.0.51106.01 Update 1). I have a Support project that compiles some C code into a (32-bit) DLL. In my header I have: #define RET_TYPE(type) _declspec(dllexport) type __stdcall RET_TYPE(int) test_dll_call(int invar); In my C file I have: RET_TYPE(int) test_dll_call(int invar) { int retVal = 4 * invar; return retVal; } I also have a (32-bit) WPF C# application that loads the DLL inside of a class as follows: [DllImport("MyDll

Where does DLLImport look for unmanaged DLLs?

你离开我真会死。 提交于 2020-01-10 18:54:13
问题 A quick question: When declaring the DLLImport Attribute in .Net, where does the runtime look to resolve that DLL dependency? Would I have to dump the DLL and all of its dependencies in the bin folder? 回答1: I think it is working like LoadLibrary. Maybe Windows path searching in LoadLibrary with manifest will be helpfull. Edit Dynamic-Link Library Search Order is probably what you want. 回答2: Generally, you'd expect it to look at whatever's defined in the user's Path. To find out what this

Where does DLLImport look for unmanaged DLLs?

橙三吉。 提交于 2020-01-10 18:54:07
问题 A quick question: When declaring the DLLImport Attribute in .Net, where does the runtime look to resolve that DLL dependency? Would I have to dump the DLL and all of its dependencies in the bin folder? 回答1: I think it is working like LoadLibrary. Maybe Windows path searching in LoadLibrary with manifest will be helpfull. Edit Dynamic-Link Library Search Order is probably what you want. 回答2: Generally, you'd expect it to look at whatever's defined in the user's Path. To find out what this