Solved

Dll, FreeLibrary and Sharemem

Posted on 2003-12-05
3
461 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
  • 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 30 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now