huginsdk / fpu

Integration libraries for Hugin NGECR via LAN or RS232
GNU General Public License v2.0
21 stars 17 forks source link

How to use sdk in Delphi? #2

Open recodabas opened 7 years ago

recodabas commented 7 years ago

Hi,

We are using Hugin YNOKC in our stores via wireless connection. We want to develop a cabled solution. Our POS software is an inhouse developed application on Delphi XE8. I couldn't find a simple way to use your dll files on Delphi. Also c# and c++ samples here didn't help much. Can you advise me an appropriate way to use FPU dlls on an unmanaged Delphi Project.

Thanks in advance, Recep Odabaş

idrissehitoglu commented 7 years ago

if you can use c dll in delphi project you can wrap c++dll into c dll. Than u can bind wrapper c dll to your delphi project

recodabas commented 7 years ago

I can't directly use theese c dll's also... Delphi requires import library (.lib) files in order to be able to import dlls. Also it can import only unmanaged dlls. There are other ways like manually writing function calls according to c header files. But it is a lot of work and open to errors especially by type conversions.

I found an explanation like this: "C does not have import units like Delphi, but an optional static import library (with accompanying header and definition file). From the C DLL we can generate a static import .LIB file with IMPLIB, and the .DEF file with IMPDEF (these tools are part of any C/C++ developing environment)." So if .lib and .def libraries are prepared with native c dlls (or may be wrapper dll) we will be able to use them in more standard way in Delphi environment.

nommaz commented 7 years ago

I remember in the past (~2010) we could call .Net DLL functions from Delphi but passing parameters was not reliable. So instead Delphi would first write function parameter values to a shared file and call .Net function without parameters. When the .Net function returned success or fail, Delphi would read the response or error file. If you could develop a basic C# wrapper to change all IO to file based approach, you may be able to call your wrapper library from Delphi successfully.

We also have a plan to create an REST API in the next few months, so that may work out better for Delphi. We will post it here when ready.

recodabas commented 7 years ago

REST API will be a solution then. It seems we are stuck in with wireless connection until this development. Shared file approach doesn't seem convenient for me. Host applications are in a far and uncontrolled environment. Supporting them can be hell. Thank you very much.

ismailkocacan commented 7 years ago

@recodabas You can use C++/C DLL's in delphi with LoadLibrary, GetProcAddress API functions.

bariskilinc commented 7 years ago

With COM Server technologies we have developed a Hugin DLL on Delphi Xe6 or newer. destek@gelisimyazilim.com