pch.h
Код: Выделить всё
#ifndef PCH_H
#define PCH_H
#include "framework.h"
//#include "Code.h"
#endif //PCH_H
Код: Выделить всё
#pragma once
#include "pch.h"
#include
using namespace std;
#ifndef ADD_CODE_H
#define ADD_CODE_H
//extern "C" //debugger says that IS NOT compatible with the __stdcall declaration
//{
__declspec(dllexport) string __stdcall add_code(string text); //same if I remove __stdcall
//}
#endif
Код: Выделить всё
#include
#include
#include "pch.h"
#include "Code.h"
using namespace std;
string __stdcall add_code(string text) { //same if I remove __stdcall
return text;
}
Код: Выделить всё
#include "pch.h"
#include "Code.h"
BOOL APIENTRY DllMain( HMODULE 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.NET я пытаюсь вызвать DLL с помощью этого кода:
Код: Выделить всё
Imports System.Runtime.InteropServices
'' //same if I remove stdcall Convention
Private Shared Function add_code(ByVal text As String) As String
End Function
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim foo As String = add_code("ppp")
End Sub
Я получаю сообщение об ошибке:
System.EntryPointNotFoundException: не удалось найти точку входа с именем «add_code» в DLL
Подробнее здесь: https://stackoverflow.com/questions/797 ... rom-vb-net
Мобильная версия