Re: C++ Library needed in Delphi App




"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: .NET Assemblies and Search Paths
    ... It looks as though the .NET assemblies I'm using are ... Delphi, I get error messages as described above. ... reports that a referenced .dll was not found, the text in front of the ... classes, etc.), but it all breaks down when I go to compile. ...
    (borland.public.delphi.ide)
  • Re: .NET Assemblies and Search Paths
    ... (.dll and .module). ... in Delphi that prevents it from being able to properly ... It looks as though the .NET assemblies I'm using are ... I was able to successfully compile them ...
    (borland.public.delphi.ide)
  • Re: Use a C++ library within Delphi
    ... then you can use the DLL with any programmnig language. ... statically link to my Delphi application. ... Functional interface, using flat exported functions which are passing ... So you could use solution a) or c) and compile a single executable ...
    (borland.public.delphi.non-technical)
  • C++ Library needed in Delphi App
    ... 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? ... Daniel ...
    (borland.public.delphi.non-technical)
  • Re: DLLs and classes
    ... >delphi application. ... >read something about virtual methods however the tutorial wasn't a perfect ... methods or fields - the code simply won't compile. ... Same logic applies - unless the DLL has the class already compiled ...
    (borland.public.delphi.nativeapi)