Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string list in a Dll, etc

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
Ok on with the dll part of the project. The help file threw me for a while till I found that the stdcall directive needs to be in the calling definitions as well as in the library.

Anyway calls to simple things {e.g the help sample} work Ok.
But this just hangs. consuming more and more resources until doomsday.

'memrecv' is a stringlist declared as a global in the datamodule. The external call is suppose to create it ready for use [no passing in or out is involved], but it just hangs.
I took the try except out so it will always return 0.
I don't know if you can use try/except in dlls?





Code:
library Ethernet;
{ To avoid using sharemempass string information using PChar or ShortString parameters. }
uses
  SysUtils,
  Classes,
  dataUnit in 'dataUnit.pas' {DataModule1: TDataModule};

{$R *.res}

function Initalise: integer;  stdcall;
begin
  result := 0;
  MemRecv := memRecv.Create;  // create a string list to hold recived messages
end;

calling program looks like this
Code:
  function Initalise: integer; stdcall; external 'Ethernet';
  function ActivateServer(LocalP: shortstring;
                          RemoteH: shortstring;
                          RemoteP: shortstring): integer; stdcall; external 'Ethernet';
  procedure Send(S: shortstring); stdcall; external 'Ethernet';
var
  Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  try
     if Initalise > 0 then
       showmessage('Initalisation Error')
  except
     showmessage('Error in Dll');
  end;
end;

assuming this can be fixed? the next stage is to get the TTcpServer/TTcpclient components to work (these are in the data module) the help says this
delphi help said:
Note
If your application includes VisualCLX components, you must use packages instead of DLLs or shared objects. Only packages can manage the startup and shutdown of the Qt shared libraries.
Does this apply here?
The demo seems to have 'Q' prefix versions of all the normal librarys in its uses clause, what is the difference?

The code server recieve code (from the demo) involves threading, again daddy asked somone if there dll involved multithreading but there was no answer, what are the implications?


Steve [The sane]: Delphi a feersum engin indeed.
 
VisualCLX is for Kylix development, so I suppose this is not applicable to you.

on to your problem.
the sharemem memory manager from borland sucks. that's why they've decided to replace it with a better performing mem manager from pierre le riche. it is called fastmm4 and can be downloaded here:

just include fastmm unit in client and server application and all should work well...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Answering part of the above question, Qcontrols are versions for use with cross platform devs (not what I need to do) so as the dll compiles with Non Q versions of everything it should work?
Still dosnt explain why if I remove the Q prefix from the netchat demo 'uses' The compiler puts them back in! I cannot see any compiler or linker options to make it complile cross platform?




Steve [The sane]: Delphi a feersum engin indeed.
 
Still dosnt explain why if I remove the Q prefix from the netchat demo 'uses' The compiler puts them back in! I cannot see any compiler or linker options to make it complile cross platform

this means that you still have a clx component on the form. delete the clx component(s) and units will not longer be included...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top