ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Possibilities of passing content bet. two ieViews
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
725 Posts

Posted - Jan 24 2017 :  06:05:29  Show Profile  Reply
Hello,

We have started refracting our software which has grown to a huge proportion to get a grip on its size, bugs, crashes, etc.

While refracting it we have come to a decision that we need to split a few functionalities between the main software and sub parts (that will be developed and maintained as DLLs).

Before we move any further in our refraction process I would like to know if there are possibilities of sharing or transmitting content on ImageEnView/Vect in the Main App (that is in the EXE file) to a DLL which is supposed to do some processing on the contents and send them back.

Is this possible?
If Yes please guide me as to how to achieve...

Will it affect the overall speed?
If Yes then how much speed loss is to expect...

TIA


Yogi Yang

spetric

Croatia
308 Posts

Posted - Jan 24 2017 :  06:34:16  Show Profile  Reply
Passing objects across the module boundaries (EXE->DLL) is generally not consider safe.

However, if both EXE and DLL are written i Delphi, it's possible, but with
some limitations:

http://stackoverflow.com/questions/15504047/tobjectlist-between-exe-and-dll-in-delphi





Go to Top of Page

yogiyang

India
725 Posts

Posted - Jan 25 2017 :  00:58:49  Show Profile  Reply
<blockquote id="quote"><font size="1" face="Arial, Helvetica" id="quote"> <hr height="1" noshade id="quote">Passing objects across the module boundaries (EXE->DLL) is generally not consider safe.

However, if both EXE and DLL are written i Delphi, it's possible, but with
some limitations:[/quote]

Wow that is great. But how in case of ImageEn?

Can you give some ideas as my DLLs wil be written in Delphi only...

And I should mention that I want to pass the data between the two not Objects.

TIA


Yogi Yang
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Jan 25 2017 :  05:08:56  Show Profile  Reply
Passing standard type variables, structures, pointers to some data (Pointer, PChar, PByte, etc..), pointers to some call-back functions is not a problem.

Problem arises when you want to pass an object. You can not pass TImageEnView
object unless you use some shared memory manager.

You can pass TImageEnView content, such as Scanline which is simple void pointer. It's not a problem. Your DLL can do something with "raw" data passed and it will alter the content of EXE's object.

If your DLL is created so that it can use VCL components, you can have some TImageEnView inside DLL.

For Example, if you have some TImageEnView in your EXE (ViewEXE), and some TImageEnView in DLL (ViewDLL), you can pass the ViewEXE.IEBitmap scanlines (or last Scanline if image is not fragmented) and then construct ViewDLL.IEBitmap from passed scanlines (data copy). Then you do some manipulation in ViewDLL (for sake of simplicity, let's say you don't alter image size) and then update ViewEXE.IEBitmap scanlines with View.IEBitmap scanlines data, or alternatively return scanlines from DLL and let the EXE's code update ViewEXE.

HTH,
Siniša

Go to Top of Page

yogiyang

India
725 Posts

Posted - Jan 26 2017 :  00:22:06  Show Profile  Reply
@Spectric,

Thanks for the elaborate explanation.

Now I am getting ideas as to how to proceed.

I am thinking that would it be possible to pass a Stream between Main EXE and DLL?

Of course I will have to play this to see actual performance penalties this may have. But after reading your post I think we can pass data between the two using Stream!

Once again thanks.

TIA


Yogi Yang
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Jan 26 2017 :  04:20:19  Show Profile  Reply
As stated in documentation:

"TStream is the base class type for stream objects that can read from or write to various kinds of storage media, such as disk files, dynamic memory, and so on."

You can not pass objects across the module boundaries without shared memory manager (in C++: MEMMGR.LIB, BORLNDMM.DLL) .

If you use TMemoryStream, try with Memory property to pass the raw data to DLL.
It should be clean and easy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: