Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dll, FreeLibrary and Sharemem

Posted on 2003-12-05
3
Medium Priority
?
495 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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