VB调用VC DLL函数

—————————————————————————VC部分—————————————————————————————————————

声明
********************************************************************************************************
extern "C" _declspec(dllexport)[] _stdcall []
********************************************************************************************************

DLLmain代码填充部分:
********************************************************************************************************
BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

———————————————————————————VB部分—————————————————————————————
声明
********************************************************************************************************

(Public/private/)Declare Function [] Lib "[路径]" Alias"[DLL原名]"([参数表]) As [返回类型]

********************************************************************************************************
时间: 2024-08-24 23:05:43

VB调用VC DLL函数的相关文章

VB调用VC dll的返回方式

第一种类型:数值传递 注意:在VB中,默认变量传递方式为ByRef为地址,而传递值就是用ByVal,还要注意在C++中,int类型的变量是32位的,在VB中要用long型变量来配合.VC++部分: [cpp] view plaincopy extern "C" _declspec(dllexport) int __stdcall TestCalc(int source) { //AFX_MANAGE_STATE(AfxGetStaticModuleState()); return(++

C语NET调用 C++ dll 函数 时传递字符串 需要注意的问题

1:C# 调用 返回 字符串 C++ native dll 函数 的注意事项: a:C++ DLL的返回值,安全的做法是分配一个全局 char 数组,把要返回的 char * 复制到这个 char 数组中, 1 char buff[255]; 2 3 const char* __stdcall ReturnString() 4 { 5 strcpy(buff,"xxxxxxxxxxxxxxx"); 6 return buff; 7 } b:C# 收到 字符串后,需要 Marshal 1

VB调用标准Dll的时候提示找不到模块的问题

可能存在的情况: 1.Private Declare Function ReadFormInit Lib "iReadFormApi.dll" Alias "[email protected]" () As Integer 加下划线的函数名称不对 2.iReadFormApi.dll库调用的其他依赖库没有放到执行目录中!我就是因为这个原因导致了总是找不到模块的提示!!!

IronPython调用C# DLL函数方法

C# DLL源码 using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; namespace Common { public class SimpleHash { public string HashCalc(byte[] audioBuffer, byte[] key) { ...... return result; } } } 需要在IronP

Python调用C++DLL函数出错String类型问题

调用c++ 函数原型如下,一直失败,请个日志断点发现 参数未能正确解析. int EXPORT init_ner(string cfg_path); typedef int (*Proc_init_ner)(string cfg_path); int EXPORT fini_ner(); typedef int (*Proc_fini_ner)(); string EXPORT process(string input_jsn_str); typedef string (*Proc_proces

vb调用C#dll

?c++ 调用DLL函数,出现错误

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. 错误原因

c#/vb调用c编写的标准dll

准备: 首先打开vc++ 6.0新建工程,选择Win32 Dynamic Link-Library,命名为stdLibrary 新建library.cpp文件,内容如下 #include <stdio.h> #include <windows.h> BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } HRESULT __stdcal

2015.5.9 C#编写DLL及C#调用C#DLL

过程比C#调用VC++dll简单. 一.创建DLL 新建工程,类型选择类库,生成的结果就是dll 注意:在项目属性-应用程序中,注意三个地方,程序集名称和默认命名空间可以调整,但要一致,别的程序调用此DLL时,可通过using命名空间,而后类名+函数名调用.输出类型保持默认的"类库"不变. 此DLL中可以应用VC创建的DLL,但此时本DLL属性只能是X86.调用vc++dll方法还是用 [DllImport("space.dll")] public static e