Re: C++ Library needed in Delphi App



Well I figured I might have to write some wrapper functions, but for my current project I must be able to read NeXus format. Do you know of any other API's or any other way I could read NeXus files? It's been ages since I used C++ but I'll try to remember how to do some of this stuff in the mean time. Thank you for the reply Remy.

- Dan


"Remy Lebeau (TeamB)" <no.spam@xxxxxxxxxxx> wrote in message news:47506d48$1@xxxxxxxxxxxxxxxxxxxxxxxxx

"Dan" <frozendice@xxxxxxxxx> wrote in message news:47506714@xxxxxxxxxxxxxxxxxxxxxxxxx

When there is a library in, let's say C++ and you want to use it in
a Delphi application isn't it possible to make that library into a dll
(assuming you have the source code), then access the dll's functions
from Delphi?

Yes, provided the functions are exported using calling conventions and data types that Delphi supports.

I need to do this with the NCL NeXus reading/writing library
which is written in C++, anyone know of a guide or any source
which might explain how I could wrap up this library into a dll?

NCL is designed to be used as a static .lib file that is compiled directly into a C++ executable. It is not designed to be compiled into its own DLL as-is. Also, all of its functionality is implemented as classes, which can't be exported from a DLL. And some of the class method paramters and data members use the STL, which Delphi can't use at all. So, to do what you are asking, you will have to first compile NCL to a .lib file, then create a separate DLL project that includes that .lib file, and have the DLL export its own flat functions that wrap the desired class operations. Only then will Delphi be able to use it.


Gambit


.



Relevant Pages

  • Re: problem using delphi dll in vc++
    ... I just don't understand how you were able to link a Delphi DLL ... I just don't know where your LIB file is coming from, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Delphi 2006 with C++ Builder
    ... > can create LIB file on DLL. ... In Delphi you have common VMT. ... TFrame from DLL ... > has different pointer to its VMT then in EXE so 'is' 'as' ...
    (borland.public.delphi.non-technical)
  • Using Lib Files with Delphi
    ... Is there anyone with any suggestions as to how to convert a .lib file ... to a .dll so as to use it in Delphi. ... Alan Lloyd ...
    (comp.lang.pascal.delphi.misc)
  • Re: Using VB6 dll in Delphi app.
    ... to make a *windows standard* .dll with VB6. ... The trouble occurs when we try to use it in a Delphi app. ...
    (microsoft.public.vb.general.discussion)
  • Re: New Delphi roadmap is coming: NO UNICODE PLEASE!
    ... Avoids DLL hell, because it ... The app is deployed and the user is getting an error. ... instances where upgrading .NET broke things that were working. ... Coming from Delphi, this isn't any big deal of course. ...
    (borland.public.delphi.non-technical)