dllimport

C# struct to C++ Marshalling problem

Hi All. I'm invoking a C++ function from within C#. This is the function header in C++ : int src_simple (SRC_DATA *data, int converter_type, int channels) ; And this is the equivilent C# function : [DllImport("libsamplerate-0.dll")] public static extern int src_simple(ref SRC_DATA sd, int converter_type, int channels); This ...

Difference between dllimport and getProcAddress.

Hi. First, I know that it doesn't make sense to compare the dllimport attribute and the getProcAddress function directly. Rather, I am interested in comparing two pieces of code, that achieve basically the same thing - calling a function in a dll - by either importing the function with the dllimport attribute or with the getProcAddress ...

C# - DLLImport and function default values

I'm interfacing with a native 3rd party C++ DLL via C# and the provided interop layer looks like below: C#: [DllImport("csvcomm.dll")] public static extern int CSVC_ValidateCertificate(byte[] certDER, int length); C++: CSVC_Status_t CSVCOMM_API CSVC_ValidateCertificate(BYTE* certDER, DWORD length, DWORD context = CONTEXT_DEFAUL...

Python 2.5 Import dll AttributeError

I have a program that runs peachy in Py2.4. I import the TobiiPlugin.dll file and then run my scripts. import TobiiPlugin as tobii tobii.setGazeSubjectProfile(3, 0) However, when I moved the code to Py2.5 it gets angry at me and I get Traceback (most recent call last): File "C:\tobiiDll\TobiiPlugin\Debug\logger_speech.py", line 27...

Obtain a filename from a file handle?

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

Why use DllImport Attribute as apposed to adding a reference?

I've seen a couple of examples such as this: [DllImport("user32.dll")] static extern bool TranslateMessage([In] ref Message lpMsg); [DllImport("user32.dll")] static extern IntPtr DispatchMessage([In] ref Message lpmsg); But, what I don't understand is why someone would do that as apposed to just referencing the DLL like they do other...

Win 7 DllImport C# Odd error, Invalid access to memory location?

I am using DllImport to access some functions in a C++ dll from my C# application. This code works fine on my dev laptop, which is Windows 7 64bit, the dll itself is 32 bit, so I run the process hosting the dll in 32bit and it works well. However when I try to run the exact same process on my target machine, which is again, Windows 7 64...

Add COM 32 to VB.NET

How can I add a COM DLL to A VB.NET project? ...

Calling a C++ .dll from C# throws a runtime error ...

Hi all, The following line is generating a runtime error in a C# GUI: int x = myclass.number_from_dll(); I'm using Microsoft Visual Studio 2008. The code in C# is: class myclass { [DllImport("strat_gr_dll.dll", EntryPoint = "number_from_dll")] public static extern int number_from_dll(); } The code in the C++ .dll is: // This...

Making an installer for .net application that depends on avifil32.dll?

I am new to .net and have this problem: I want to make installer for application that uses avi wrapper described here. That library depends on avifil32.dll as I've found out in the source which contains [DllImport("avifil32.dll", PreserveSig=true)]. I've made setup project in visual studio 2008 and installer is working fine on some m...

How to Import a C/C++ dll to .NET application

Hi, In my new project I want to use a existing C C++ functions . For that I would need to add the C/C++ dlls to C# project. My C/C++ projects is of type UnManaged and it is not a COM Project. I have seen few articles after from MSDN and tried: [DllImport("user32.dll", EntryPoint="MessageBoxA")] But I am not sure Where should I place...

GNU GPL question

I have a C# app that hooks into a GPLed DLL via DllImport. The DLL has its own installer which we plan to package with and run from our own app's installer. Will these require us to GPL our own app as well? ...

How do I declare this dll method in Delphi?

I have a function in a DLL (the c header is): int my_c_function( const int cnames[10], const char *delim, size_t delim_size, char *buffer, size_t *buffersize); I've tried function my_c_function(cnames: Array of integer; const delim : PAnsiChar; delim_size : integer; ...

32 bit dllimport generating incorrect format error (0x8007000b) on win7 x64 platform

Hello, I'm trying to install and run a 32 bit application on a Win7 x64 machine. The application is built as a Win32 app. It runs fine on 32 bit platforms. On the x64 machine it installs correctly in the Programs(x86) directory and runs fine until I make a call into a 32 bit dll. At that time I get the incorrect format error (0x80070...

Delphi Loadlibrary returns 0 (LastErrorcde=3221225616) What does this mean ?

Hey, I need to use a 3rd party dll in our main app. When I staticly link to the provided DLL it works ok and I can the DLLs exported functions. But we don't want our main app dependend on this dll on startup so I tried to dynamicly load the DLL when I need it : DLLHandle := LoadLibrary('3rdparty.dll'); ret := GetLastError(); if DLLHandl...

Problem with importing DLL into Inno-Setup.

I am importing an C++ DLL in an innosetup install script. The DLL code is as follows: void __stdcall SetFbParam(char *dbFileName,char *dbTableName,char *dbParamName,char *dbParamValue){ //of no use here and doesn't change anything} In the Innosetup, I import it using procedure FBset(dbFileName,dbTableName,dbParamName,dbParamValue: St...

How to amend DLLs

Hello experts, We are using an external Dlls as : [DllImport("DemoExport.dll")] public static extern string GetDBConnection(string sDBName); [DllImport("DemoExport.dll")] public static extern int CreateEmptyDBFromDB(string SourceDBName, string DestinationDBName); [DllImport("DemoExport.dll")] Now, we want to add new m...

A warning with building 64bit dll

dll export header extern "C" void _declspec(dllexport) __stdcall foo(); .def file EXPORTS foo @1 When I build the dll by 64bit build config, I meet this warning. warning LNK4197: export 'foo' specified multiple times; using first specification But If I build the dll by 32bit build config, the warning never occurs. Wha...

How Can I call a C++ Win32 DLL from another C++ win32 Console Application

What is my main concern is , I am able to write a C++ dll using VC++ . Now the dll is present in the Debug folder. How can I use my DLL in other C++ Console Application. How to add reference or link the DLL to the application. Another point, While creating a DLL , The VC++ wizard gives me thre option: An Empty DLL project A Simple DL...

DllImport doesn't work as advertised in Mono (Linux, C#) (UPDATED)

I'm getting to know Mono development in Linux, in baby steps. I'm trying to call Linux C libraries. This page, in theory, tells me how, but when I type the code below in MonoDevelop 2.2.2 (Fedora 13), I get a "Parsing Error (CS8025)" in "private static extern int getpid();". Moreover, the help system doesn't work. EDIT: I just had to mo...