dllimport

Run Fortran DLL with Visual Studio

让人想犯罪 __ 提交于 2019-12-17 19:55:29
问题 I develop a website with Visual Studio 2010. I want to run a Fortran DLL. I used Intel Visual Fortran to create a .dll and to test how to use it. My code is: SUBROUTINE SIMPSON (N,H,I) !DEC$ ATTRIBUTES DLLEXPORT, DECORATE, ALIAS : "SIMPSON" :: SIMPSON !DEC$ ATTRIBUTES REFERENCE::N !DEC$ ATTRIBUTES REFERENCE::H !DEC$ ATTRIBUTES REFERENCE::I INTEGER N,H,I I=N+H RETURN END which practically takes two integers, adds them and return the result. Now I have the .dll I don't know how to run it with

c++ exporting and using dll function

白昼怎懂夜的黑 提交于 2019-12-17 19:54:47
问题 I can't quite figure out where there is a mistake. I am creating a DLL and then using it in a C++ console program (Windows 7, VS2008). But I get LNK2019 unresolved external symbol when trying to use the DLL functions. First the export: #ifndef __MyFuncWin32Header_h #define __MyFuncWin32Header_h #ifdef MyFuncLib_EXPORTS # define MyFuncLib_EXPORT __declspec(dllexport) # else # define MyFuncLib_EXPORT __declspec(dllimport) # endif #endif This is one header file I then use in: #ifndef __cfd

Call C# dll function from C++/CLI

ε祈祈猫儿з 提交于 2019-12-17 16:34:13
问题 I have a C# dll. The code is below: public class Calculate { public static int GetResult(int arg1, int arg2) { return arg1 + arg2; } public static string GetResult(string arg1, string arg2) { return arg1 + " " + arg2; } public static float GetResult(float arg1, float arg2) { return arg1 + arg2; } public Calculate() { } } Now, I am planning to call this dll from C++ on this way. [DllImport("CalculationC.dll",EntryPoint="Calculate", CallingConvention=CallingConvention::ThisCall)] extern void

How do I DllExport a C++ Class for use in a C# Application

时光总嘲笑我的痴心妄想 提交于 2019-12-17 15:51:44
问题 I have created a C++ Dll project which contains a class "myCppClass" and tried to Dll export it using the following code as described by: http://msdn.microsoft.com/en-us/library/a90k134d(v=vs.80).aspx class __declspec(dllexport) CExampleExport : //public CObject { ... class definition ... }; I have omitted the "public CObject" as that requires afx.h and implies it is an MFC Dll. I am not sure if this is a good thing or not but it differed from the DLL project default settings. From the above

How do I DllExport a C++ Class for use in a C# Application

丶灬走出姿态 提交于 2019-12-17 15:51:32
问题 I have created a C++ Dll project which contains a class "myCppClass" and tried to Dll export it using the following code as described by: http://msdn.microsoft.com/en-us/library/a90k134d(v=vs.80).aspx class __declspec(dllexport) CExampleExport : //public CObject { ... class definition ... }; I have omitted the "public CObject" as that requires afx.h and implies it is an MFC Dll. I am not sure if this is a good thing or not but it differed from the DLL project default settings. From the above

Read a Registry Key

六月ゝ 毕业季﹏ 提交于 2019-12-17 10:46:32
问题 I have a web application which is importing DLLs from the bin folder. const string dllpath = "Utility.dll"; [DllImport(dllpath)] Now what I want to do is first import the DLLs from a folder not in the current project but at some different location. The path of that folder is stored in a registry key. How should I do this? Edit : Why can't I work this out??? public partial class Reports1 : System.Web.UI.Page { RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(@"Software\xyz"); string

How to use [DllImport(“”)] in C#?

南笙酒味 提交于 2019-12-17 09:12:06
问题 I found a lot of questions about it, but no one explains how I can use this. I have this: using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Windows.Forms; using Microsoft.FSharp.Linq.RuntimeHelpers; using System.Diagnostics; using System.Runtime.InteropServices; using System.IO; public class WindowHandling { public void ActivateTargetApplication(string processName, List<string> barcodesList) { [DllImport("User32.dll")] public

Using a 32bit or 64bit dll in C# DllImport

て烟熏妆下的殇ゞ 提交于 2019-12-17 08:06:23
问题 Here is the situation, I'm using a C based dll in my dot.net application. There are 2 dlls, one is 32bit called MyDll32.dll and the other is a 64bit version called MyDll64.dll. There is a static variable holding the DLL file name: string DLL_FILE_NAME. and it is used in the following way: [DllImport(DLL_FILE_NAME, CallingConvention=CallingConvention.Cdecl, EntryPoint=Func1")] private static extern int is_Func1(int var1, int var2); Simple so far. As you can imagine, the software is compiled

Using a 32bit or 64bit dll in C# DllImport

对着背影说爱祢 提交于 2019-12-17 08:06:08
问题 Here is the situation, I'm using a C based dll in my dot.net application. There are 2 dlls, one is 32bit called MyDll32.dll and the other is a 64bit version called MyDll64.dll. There is a static variable holding the DLL file name: string DLL_FILE_NAME. and it is used in the following way: [DllImport(DLL_FILE_NAME, CallingConvention=CallingConvention.Cdecl, EntryPoint=Func1")] private static extern int is_Func1(int var1, int var2); Simple so far. As you can imagine, the software is compiled

Change C# DllImport target code depending on x64/x86

本秂侑毒 提交于 2019-12-17 02:23:09
问题 I have an external c++ dll to import using DLLImport. If my application is compiling in x64 I need to import the x64 version of this dll, if it is an x86 build, I need the x86 dll. What is the best way to achieve this? Ideally, I'd like some preprocessor directive, but I understand this doesn't work in c#? More info: the DLL is being imported by a project which is set to AnyCPU. A parent project is the one which determines whether the application compiles as x64 or x86. We compile both