FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
¿como hacer dll c puro en bcb2010 y loader en delphi 2010?
hola estoy haciendo una dll
en c c puro, no es cpp o c++ con el ide de c++ builder 2010 y el programa que lo consume esta hecho en delphi 2010 el problema es que no me devuelve lo que yo quiero un string para saber que paso con las instrucciones pongo el codigo. de la dll Código:
// --------------------------------------------------------------------------- // ES UNA DLL TIPOP C SIN NINGUN ESTILO NI VCL NI ESTILO VC // --------------------------------------------------------------------------- #include <windows.h> #include <string.h> #pragma argsused #include <stdio.h> #include <stdlib.h> #include <curl/curl.h> #include <curl/types.h> #include <curl/easy.h> static char *file2string(FILE *file) { char buffer[256]; char *ptr; char *string=NULL; size_t len=0; size_t stringlen; if(file) { while(fgets(buffer, sizeof(buffer), file)) { ptr= strchr(buffer, '\r'); if(ptr) *ptr=0; ptr= strchr(buffer, '\n'); if(ptr) *ptr=0; stringlen=strlen(buffer); if(string) string = realloc(string, len+stringlen+1); else string = malloc(stringlen+1); strcpy(string+len, buffer); len+=stringlen; } return string; } else return NULL; /* no string */ } static char *file2memory(FILE *file, long *size) { char buffer[1024]; char *string=NULL; char *newstring=NULL; size_t len=0; long stringlen=0; if(file) { while((len = fread(buffer, 1, sizeof(buffer), file))) { if(string) { newstring = realloc(string, len+stringlen); if(newstring) string = newstring; else break; /* no more strings attached! :-) */ } else string = malloc(len); memcpy(&string[stringlen], buffer, len); stringlen+=len; } *size = stringlen; return string; } else return NULL; /* no string */ } static size_t mywrite(void * ptr , size_t size , size_t nmemb , void * stream){ int ret = fwrite(ptr,size,nmemb,(FILE *)stream); fwrite(ptr,size,nmemb,stdout); return ret; } char __declspec(dllexport)WINAPI suma(char *ELPRIMERPARAMETRO, char *ELSEGUNDOPARAMETRO, char *ELTERCERPARAMETRO, char *ELCUARTOPARAMETRO) { FILE * header = fopen(ELPRIMERPARAMETRO,"w"); FILE * body = fopen(ELSEGUNDOPARAMETRO,"w"); char *TipoResultado; TipoResultado = "3333"; MessageBox( NULL, ELPRIMERPARAMETRO, "1r", MB_OK ); MessageBox( NULL, ELSEGUNDOPARAMETRO, "2d", MB_OK ); MessageBox( NULL, ELTERCERPARAMETRO, "3e", MB_OK ); MessageBox( NULL, ELCUARTOPARAMETRO, "4t", MB_OK ); return *TipoResultado; } int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved) { return 1; } // ---------------------------------------------------------------------------
logre que se pasen los parametros de delphi a la dll y que me los muestre el problema es que no me devuelve nada yo espero un string 3333 y no me vuelve nada solo me ha funcionado usando integer en vez de string. en la dll c en c estoy aprendiendo. y pues no se que hago mal gracias. la funcion se llama suma. por que asi se me ocurrio pero debe de regresar un string para procesarlo |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Como instalo ZeosLib en Delphi 2010 | jorosmtz | Conexión con bases de datos | 21 | 21-08-2012 00:48:46 |
delphi 2010 imagenes png¿como usarlas? | JXJ | Varios | 2 | 13-09-2010 21:40:49 |
Hacer que Delphi 2010 luzca como Delphi 7 | jorosmtz | La Taberna | 0 | 11-04-2010 22:45:36 |
¿cómo hacer un reporte con ravereport de delphi 2010 o un manual ? | Master23 | Impresión | 1 | 06-04-2010 16:43:20 |
Iniciar un Loader | REHome | .NET | 5 | 24-12-2008 10:24:29 |
|