Pregunta

I'd like create a dll to import data from a file (different format, for example csv, txt, xls, ...). My idea is this: the dll load the data with her "engine" then send this data to my application so my application can show them inside a grid.

This is my second DLL so I have some problems/questions.

I think my DLL should send the data to a TDataset on my application but how can I call a DLL with a TDataset as argument?

Any suggestions? What is the easiest way to accomplish what I have in mind? (if possible)

¿Fue útil?

Solución

Easier way for you would be to store the data directly into database in DLL. And after import you just refresh your TDataset.

BTW, you don't "call DLL", you call some method that is public in DLL and there you can use arguments as in normal methods.

EDIT: For more generic DLLs that don't require data components just send data in struct

 TMyData
 { int ID;
   String Value;
 };

int MyDataImport(TMyData & data)
{
...
}

Otros consejos

If you are the creator of those DLL's, then consider to use packages instead of DLL. This will avoid the problems, like dublicate Delphi RTTI, plain DLL API. Then you will need to properly split classes between packages, load packages statically or dynamically, get reference to a class implementing import engine, and call the corresponding method with a dataset reference as a parameter value.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top