<p>Am 21.08.2015 08:40 schrieb "Tobias Giesen" <<a href="mailto:tobiasgiesen@gmail.com">tobiasgiesen@gmail.com</a>>:<br>
><br>
> Hello,<br>
><br>
> I have to compile a few Pascal units with FPC and add them to a Visual<br>
> C++ project. After adding system.o to the Visual C++ project, I get<br>
> linker errors like this:<br>
><br>
> system.o : error LNK2001: unresolved external symbol _$dll$kernel32$Sleep<br>
><br>
> Apparently the Microsoft linker does not recognize the FPC way of<br>
> mangling the DLL dependencies? Is there a way to compile the RTL in a<br>
> way that Microsoft can link? Or anything else I can do?</p>
<p>Short answer: no</p>
<p>Long answer:</p>
<p>Where you found the system.o you should also see a libimpsystem.a or so that you should link as well.<br>
No guarantees though...</p>
<p>You also will need to manually call the initialization sections of each unit you use (check the assembler listings of the units), because otherwise for example the RTL won't be initialized which will result in unuseable code (you won't even be able to use New()).</p>
<p>A better and much less fragile solution would be to ompile the units you need into a DLL and provide a C based, flat interface. Or export functions that create interface instances as these are compatible with IUnknown (you'll need to write suitable headers then).</p>
<p>Regards,<br>
Sven</p>