dllimport

ASP.NET 2.0 app runs on Win 2003 in IIS 5 isolation mode but not in (default) IIS 6 mode

The app uses DLLImport to call a legacy unmanaged dll. Let's call this dll Unmanaged.dll for the sake of this question. Unmanaged.dll has dependencies on 5 other legacy dll's. All of the legacy dll's are placed in the WebApp/bin/ directory of my ASP.NET application. When IIS is running in 5.0 isolation mode, the app works fine - calls t...

DLLImport Int** - How to do this if it can be done.

I am trying to use a third party DLL that wants an int** as one of the parameters to the method. It describes the parameter as the address of the pointer that will point to the memory allocation. Sorry for any confusion. The parameter is two-way I think. The DLL is for talking to an FPGA board and the method is setting up DMA transfe...

Protected Memory Violation calling FORTRAN DLL from C#

I am trying to call out to a legacy dll compiled from FORTRAN code. I am new to Interop, but I've read some articles on it and it seems like my case should be fairly straightforward. The method I really want to call has a complex method signature, but I can't even call this simple GetVersion method without getting a protected memory ...

Where does DLLImport look for unmanaged DLLs?

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? ...

dllimport failed to locate dll even though it is in the PATH

I use [Dllimport("DllName.dll")] where I'm sure a path to my dll exists in the process PATH environment variable, and still I get "DllName.dll could not be found" ...

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

Hi! 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 quess I must specify wich dll to actually use when linking somehow... How do I do that? I'm compiling with borland c++ builder, but I really whant to know how theese th...

How to import const char* API to C#?

Given this C API declaration how would it be imported to C#? const char* _stdcall z4LLkGetKeySTD(void); I've been able to get this far: [DllImport("zip4_w32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "z4LLkGetKeySTD", ExactSpelling = false)] private extern static const char* z4LLkGetK...

pinvoke: uncertain how to work with dllimport and imported libraries

I am doing a dllImport on a C++ dll and I have the following signature. StackOverflow has been very helpful so far, so I thought I'd throw this one and see what I get. Are there any gotchas that I should be worried about? This is my first time using dllimport. I need to import the following to C#: HANDLE FooInit(char* name); //na...

How to import void * C API into C#?

Given this C API declaration how would it be imported to C#? int _stdcall z4ctyget(CITY_REC *, void *); I've been able to get this far: [DllImport(@"zip4_w32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "z4ctygetSTD", ExactSpelling = false)] private extern static int z4ctygetSTD(ref...

mingw spitting countless warnings about ignoring "dll import" attribute

I'm using mingw32-make to compile a qt project that uses opengl, it compiles correctly and everything, but it spits countless warning messages of the form: c:/qt3/include/qcolor.h:67: warning: inline function `int qGray(int, int, int)' declared as dllimport: attribute ignored For this particular instance, the function declaration is:...

Calling functions in a DLL from C++

I have a solution in VS 2008 with 2 projects in it. One is a DLL written in C++. The other is a simple c++ console application created from a blank project. I would like know how to call the functions in the DLL from the application. Assume I am starting with a blank C++ project and that i want to call a function called "int IsolatedFun...

DllImport vs LoadLibrary, What is the best way?

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 ? ...

Importing a C# class library into Visual C++

Hi guys, I have a C# class library that contains methods that need to be used with an external application. Unfortunately this external application only supports external APIs in C/C++. Suppose I have a takeIntReturnDoubleArray method in this C# library that takes an integer and returns an array of doubles. All I need to do is have a...

Exporting functions from C++ dll to C# P/Invoke

I have built a C++ dll that I would like to call from C# code. I'm able to call one function, but the other throws an exception when the C# code tries to load the dll. The header looks like this: extern "C" __declspec(dllexport) BOOL Install(); extern "C" __declspec(dllexport) BOOL PPPConnect(); This produces a dll with slightly conf...

Exporting class from executable to dll

I need in a DLL to use a class, defined in an executable (DLL and executable are compiled by the same compiler). But I don't want the source code of this class definition to be available to DLL, only declaration. One possible way to do it is to make all the necessary class methods to be virtual (so that DLL linker will not need these me...

C# program (process) will not unload

I have a C# program that uses a class from another assembly, and this class calls an unmanaged DLL to do some processing. Here is a snippet: public class Util { const string dllName = "unmanaged.dll"; [DllImport(dllName, EntryPoint = "ExFunc")] unsafe static extern bool ExFunc(StringBuilder path, uint field); public bo...

P/Invoke [DllImport] on ASP.NET

Hi, I'm having some problems with concurrency when using DLLImport, I have a Dll that provides some report I need to send over the web, so I have this: [DllImport("Rep.dll", EntryPoint = "PrintRep", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern string PrintRep(several params...); And ov...

"Unable to find an entry point named [function] in dll" (c++ to c# type conversion)

I have a dll which comes from a third party, which was written in C++. Here is some information that comes from the dll documentation: //start documentation RECO_DATA{ wchar_t Surname[200]; wchar_t Firstname[200]; } Description: Data structure for receiving the function result. All function result will be stored as Unicode (UTF-8). ...

DllImport with different entry points (different DLLs for the same import in different projects)

As a follow-up to my recent question about .NET Compact Framework debugging, I am currently trying to use OpenGL ES from both a .NET Compact Framework and a .NET Framework application. I use this wrapper, which has been created for OpenGL ES and imports from libGLES_CM.dll. To make debugging easier, I created a .NET Framework applicatio...

Embedding unmanaged dll into a managed C# dll

I have a managed C# dll that uses an unmanaged C++ dll using DLLImport. All is working great. However, I want to embed that unmanaged DLL inside my managed DLL as explain by Microsoft there: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.dllimportattribute.aspx So I added the unmanaged dll fil...