Recent

Author Topic: Using c++ dll in lazarus  (Read 8624 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Using c++ dll in lazarus
« Reply #15 on: February 13, 2019, 01:03:17 pm »
That still leaves that he has enough information (the def and the API) but not enough determination to take on the task...
API's are strange things: the larger they are the less functionality you use in my experience, so pick and choose is a real option most of the time. (e.g. sqlite is not fully translated, but fully functional in normal life)
« Last Edit: February 13, 2019, 01:05:31 pm by Thaddy »
Specialize a type, not a var.

mig-31

  • Sr. Member
  • ****
  • Posts: 305
Re: Using c++ dll in lazarus
« Reply #16 on: February 13, 2019, 05:07:11 pm »
As I see your motheboard have 8 DIO(configurable digital input/output). Because it is I/O port, you can control it thought I/O port memory address, like motherboard COM or LPT port. In this case you need OS, which provided direct memory access, for example Linux (needed
root permition) and you don't need any C++ SDK.

Use these functions to do it https://www.freepascal.org/docs-html/current/rtl/x86/index-5.html
Code: Pascal  [Select][+][-]
  1. fpIOperm
  2. WritePort
  3. ReadPort
  4.  
Lazarus 2.2.6 - OpenSuse Leap 15.4, Mageia 8, CentOS 7

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Using c++ dll in lazarus
« Reply #17 on: February 15, 2019, 08:05:54 am »
That still leaves that he has enough information (the def and the API) but not enough determination to take on the task...
API's are strange things: the larger they are the less functionality you use in my experience, so pick and choose is a real option most of the time. (e.g. sqlite is not fully translated, but fully functional in normal life)

I think I should remind you I'm not the same as the OP and we attempt to solve a different problem  :)

kirill

  • Newbie
  • Posts: 3
Re: Using c++ dll in lazarus
« Reply #18 on: April 02, 2022, 03:27:40 pm »
Anobody can help me create pas file for driver?
Driver Shtrih-M for cash-device. In delphi I can import ActiveX component and save as pas file. But this file I can't use in Lazarus witch don't support OLE. I found project in github https://github.com/shtrih-m/fr_drv_ng with c++ headers for driver. Anybody can create pas file from this headers?
I'm interesting release for windows. 

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Using c++ dll in lazarus
« Reply #19 on: April 02, 2022, 03:31:06 pm »
Anobody can help me create pas file for driver?
Driver Shtrih-M for cash-device. In delphi I can import ActiveX component and save as pas file. But this file I can't use in Lazarus witch don't support OLE.

Pascal should roughly work with the Delphi import file, and has its own (commandline) importer called importtl.

BSaidus

  • Hero Member
  • *****
  • Posts: 540
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: Using c++ dll in lazarus
« Reply #20 on: April 02, 2022, 08:39:18 pm »
You can find usefull informations about how to use C++ classes in Delphi.
http://rvelthuis.de/articles/articles-cppobjs.html
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

kirill

  • Newbie
  • Posts: 3
Re: Using c++ dll in lazarus
« Reply #21 on: April 02, 2022, 08:51:18 pm »
Pascal should roughly work with the Delphi import file, and has its own (commandline) importer called importtl.
I right understand that I must run importtl some_file.h?
I try run for each file (not only .h) but have error

Reading typelib from classic_interface.h ...                                                                            An unhandled exception occurred at $000000010003E4EF:                                                                   EOleSysError: Ошибка при загрузке библиотеки.                                                                             $000000010003E4EF                                                                                                       $000000010002D44D                                                                                                       $000000010002E2A8                                                                                                       $0000000100022E9B                                                                                                       $0000000100001F34                                                                                                       $0000000100002356                                                                                                       $0000000100011F10                                                                                                       $0000000100001820                                                                                                       $00007FFCAA647034                                                                                                       $00007FFCAA782651                                                                                                     


PS. Sorry for my badly english.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Using c++ dll in lazarus
« Reply #22 on: April 02, 2022, 08:59:38 pm »
Pascal should roughly work with the Delphi import file, and has its own (commandline) importer called importtl.
I right understand that I must run importtl some_file.h?

You shouldn't use this on the header files. This is for importing the type library. You can also install the LazActiveX package that will add a menu item to import an ActiveX component as well (yes, FPC does support OLE/ActiveX without any (currently) known problems).

kirill

  • Newbie
  • Posts: 3
Re: Using c++ dll in lazarus
« Reply #23 on: April 03, 2022, 02:01:16 am »
Sorry, my english pour and I can't tell what's problems. Thank you, PascalDragon, I understand you message and I install and import DrvFR.dll from system. But in Delphi create module with class TDrvFR witch I use in Delphi and have small knowledge, but Lazarus create IDrvFR and I don't know hove it's use. And you can't help me with my language. Thank you all for home help me, but I go russian forum with my problem. Thank you.

PS. @marcov, I understand what you mean about importttl, and I'm import dll with this tool too, but it's don't have (simple for me TDrvFR) . Delphi module without number, Lazarus with 1_3
« Last Edit: April 03, 2022, 02:12:59 am by kirill »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Using c++ dll in lazarus
« Reply #24 on: April 04, 2022, 01:41:31 pm »
PS. @marcov, I understand what you mean about importttl, and I'm import dll with this tool too, but it's don't have (simple for me TDrvFR) . Delphi module without number, Lazarus with 1_3

You need to instantiate TAxcDrvFR instead and then use the OleServer property to access the functionality of the library.

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Using c++ dll in lazarus
« Reply #25 on: April 04, 2022, 02:03:11 pm »
@kirill
>Sorry, my english pour and I can't tell what's problems.

Consider to use google-translate, it gives OK results!

 

TinyPortal © 2005-2018