ADODataset in dll and ShareMem

Posted on 2003-02-25
Medium Priority
Last Modified: 2010-04-04
First of all, is it possible to declare function of type TDataSet with stdcall
function NotesList(sOwner:string):TDataSet;stdcall;
 If it is, should I include ShareMem in my dll?

Or there is a better way to do this?

What I want to do is to separate data access from the rest of my application, because database might be Access, SQL Server or Firebird. They all have slightly different SQL syntax.
But I still want to get TDataSet or TADODataSet from the data access layer because I want to be able to do further processing with it before binding to a grid.

I know I can do that by writing an additional class that will be in exe, but I am considering dll for some reasons.
Question by:bogiboy
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
  • 4
  • 2

Accepted Solution

mocarts earned 200 total points
ID: 8023792
first of all your function have a string parameter which requires ShareMem if used in dll.
and yes, if you want pass between exe and dll TDataSet (as it uses strings too) then you need include ShareMem as your first unit in project.

wbr, mo.

Expert Comment

ID: 8023814
one note: you should use ShareMem in both - exe and dll

as far as I know, there is two alternatives to ShareMem (which is wraper for DLL) - FastShareMem and MultiMM (search in Google for keywords). but both have some disantvages and advantages (I don't like disantvages in memory managmen - so when I need to use shared memory I use standard ShareMem)

wbr, mo.

Author Comment

ID: 8027262
Thanks mocarts
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!


Expert Comment

ID: 8033546
I think it must be
function NotesList(sOwner:WideString):TDataSet;stdcall;

and no problem with ShareMem

Expert Comment

ID: 8033602
stdcall is calling convention - it don't manage memory.
from delphi help:
"If a DLL exports routines that pass long strings or dynamic arrays as parameters or function results (whether directly or nested in records or objects), then the DLL and its client applications (or DLLs) must all use the ShareMem unit"

TDataSet uses strings (Filter, Name etc.)
wbr, mo.

Expert Comment

ID: 8033703
mocarts, you are right.
But in this case we send WideString and TDataset automaticaly convert it to string.

Expert Comment

ID: 8033741
WideString is a parameter
TDataSet is return type..
where is conversion? :)

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

764 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