[Lazarus] Using Visual C++ .libs?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Jun 1 15:43:06 CEST 2011


Prado, Renato (R.P.) schrieb:
>> You'll have to implement an wrapper, that allows to access the objects
>> and their methods by mere (non-OO) subroutines. That wrapper will have
>> to be written in the language of the library (here: C++), so that it
> can
>> use the objects provided by the library, and can call their methods.
> The
>> headers of the wrapper have to be converted into a unit (library?),
> for
>> use from OPL code.
>>
>> DoDi
> By wrapper you mean generating a unit translating the interface from the
> .h right?

A C++ library requires real code, that allows for communication with the 
C++ objects. But if the header files already contain a C style 
interface, no such wrapper code is required; in this case only a 
translation from .h into .pas is required.

> After I got the unit, how can I link the .lib into my project?

I have no experience in mixing FPC and C/C++ code into one executable. 
Both languages come with their own RTL and other libraries, which can 
not always coexist (initialization issues...). When the linker does not 
reqest more C-specific modules than available with FPC, it might work.

The linker also must understand the object format of the compiled library.

> I would not like to create a DLL in Visual C++ with the .lib inside just
> to be able to use the .lib functions within Lazarus.

A DLL can be built with the Visual C++ linker, so that above issues go away.

DoDi





More information about the Lazarus mailing list