Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi fill pointer in DLL from app (https://www.delphipraxis.net/114997-fill-pointer-dll-app.html)

mohfa 4. Jun 2008 04:17


fill pointer in DLL from app
 
How to pass the parameter to DLL, the parameter is a pointer to the record .
in my Dll i have :

Delphi-Quellcode:
type
  PList = ^AList;
  AList = record
  nam:String;
  Orders: TList;
  end;
so how could i fill this parameter from my app;

regards

SirThornberry 4. Jun 2008 06:57

Re: fill pointer in DLL from app
 
you have to work with sharemem because in your record are objects and dynamic strings.
Then you have to call your function in your dll like any other function.
But I wunder. You use a record and a TList object. So you mix global programming with oop. why don't you use only one of both?

Muetze1 4. Jun 2008 12:38

Re: fill pointer in DLL from app
 
With the use of sharemem or fastmm you can pass the string from the app to the dll, but an object instance (simple VCL objects) will not work correctly.

mohfa 4. Jun 2008 19:36

Re: fill pointer in DLL from app
 
thank SirThornberry , but is there any other alternative so that i can use Strings in my Dll without using ShareMem unit .

Because when using ShareMem i think my Dll will be used only by My app .

Muetze1 4. Jun 2008 20:55

Re: fill pointer in DLL from app
 
use PChar as type for strings and do it like the WinAPI: the caller has to allocate the memory for results and the DLL fills the memory of the app - or returns the needed space, if the allocation is is too small.


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:19 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz