Solved

Dll, FreeLibrary and Sharemem

Posted on 2003-12-05
3
476 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2 77
Dev Express grid collapse 2 48
Convert MS Word document to a PDF file 9 115
How to load 2 images in same column in Delphi 2 68
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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