![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#3
|
|||
|
|||
|
Esclareciendo
Mis disculpas por las infracciones.
Para tratar de obtener, la vinculación de la DLL con Delphi, realicé una DLL sencilla que solamente contiene la función function plusone(val : Integer) : Integer; export; stdcall; que simplemente suma 1 al parámetro val En el archivo DPR incluí la cláusula export de la siguiente manera Exports plusone name 'plusone@4', La clase de C++ que cargará la DLL es así /* Carga.h*/ #define USELIB #ifdef USELIB extern "C" { int __declspec(dllimport) __stdcall plusone(int); } #endif //USELIB ref class Carga { public: Carga(void); ~Carga(void); int SumaUno(int i); protected: #ifndef USELIB HINSTANCE hMyDLL; FARPROC lpfnplusone; typedef int (*pIIFUNC)(int); pIIFUNC plusone; #endif //USELIB /*Carga.cpp*/ #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif Carga::Carga(void) { #ifndef USELIB hMyDLL = LoadLibrary("D:\\Delphi to C++\\DLL\\MyDLL.dll"); if(hMyDLL == NULL) PostQuitMessage(1); lpfnplusone = GetProcAddress(HMODULE(hMyDLL), "_plusone"); if(lpfnplusone == NULL) PostQuitMessage(2); plusone = pIIFUNC(lpfnplusone); #endif //USELIB } Carga::~Carga(void) { #ifndef USELIB if (hMyDLL != NULL) FreeLibrary(hMyDLL); #endif //USELIB } int Carga::SumaUno(int i) { int temp = plusone(i); return i; } El error a la hora de compilar es el siguiente: Error 1 error LNK2028: unresolved token (0A00000A) "extern "C" int __stdcall plusone(int)" (?plusone@@$$J14YGHH@Z) referenced in function "public: int __clrcall Carga::SumaUno(int)" (?SumaUno@Carga@@$$FQ$AAMHH@Z) Carga.obj Gracias anticipadas y disculpen lo extenso que quedó el mensaje |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Como cargar qrpt70.bpl paquete desde delphi | JODELSA | Impresión | 3 | 04-03-2016 09:51:55 |
| Como instalo una aplicacion hecha en delphi 6. con bdd de paradox sin instalar delphi | CarlosHernandez | Tablas planas | 5 | 17-06-2011 18:27:09 |
| Como cargar una DLL hecha en delphi desde c++? | Ege | API de Windows | 0 | 03-03-2008 22:03:37 |
| Como cargar un fichero .js desde PHP | maro | PHP | 2 | 03-10-2007 19:31:02 |
| Como puedo cargar un SQL DTS desde Delphi? | Elektron | Conexión con bases de datos | 2 | 31-07-2003 11:03:52 |
|