?
Solved

Dll, FreeLibrary and Sharemem

Posted on 2003-12-05
3
Medium Priority
?
489 Views
Last Modified: 2010-04-05
Hi

Here is a code that I am trying to call a procedure from a x dll.
procedure Test;
var
i: integer;
Module: THandle;
msg: TPlugProc;
begin
i:=0;
with PlugList do
 while i<Items.Count do
  begin
    Module:=SafeLoadLibrary(PChar(plugInsDir+Items[i]));
   try
     @msg:=GetProcAddress(Module,'MyMessage');
     if @msg<>nil then
       msg;
   finally
    if Module<>0 then
      FreeLibrary(Module);
   end;
  i:=i+1;
  end;
end;

I have problems with FreeLibrary if I add Sharemem in uses clause as it describes in Borland dll project. If Sharemem is not added then it works.
Can someone explain why?
Can it be any problems without Sharemem?
Some suggestions?

thanks,
mha
0
Comment
Question by:michaenh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:michaenh
ID: 9881721
Hi again delphi lovers.. :)

If I use FastSharemem instead of Sharemem then it works..

cheers,
mha

0
 
LVL 8

Accepted Solution

by:
gmayo earned 90 total points
ID: 9881777
You only need ShareMem if you share data between the app and the DLL. This includes string types. PChar is okay without ShareMem.

Geoff M.
0
 

Author Comment

by:michaenh
ID: 9881820
Hi.. :)

>You only need ShareMem if you share data between the app and the DLL.

Yes I do share data between the app and the dll.
Instead of Sharemem I now use FastSharemem.

thanks,
mha
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question