<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Darius:<br>
<br>
I just went through this and it is fresh in my mind, but with 32 bit
code.<br>
<br>
I used CodeBlocks with MingGW to compile the c source code to a
static library with an mylib.A suffix.<br>
<br>
I am pretty sure you cannot use MSVC to compile the c code.<br>
<br>
Then use the {$LINKLIB path/mylib.a} directive to link.<br>
<br>
You do not need to use individual object files since many times
there are many that are combined into a single static library.<br>
<br>
When you use codeblocks, you will need to make an adjustment to
produce 64 bit binary.<br>
<br>
It is just easier to stay with 32 bit if you can.<br>
<br>
Let us know how it turns out in 64 bit {$LINKLIB xxxx}<br>
<br>
Cheers,<br>
<br>
md<br>
<br>
<br>
<div class="moz-cite-prefix">On 3/19/2014 6:49 PM, Darius Blaszyk
wrote:<br>
</div>
<blockquote
cite="mid:bf732ce2073dd8646e583a0f61ee0937@zeelandnet.nl"
type="cite">
<p>Hi,</p>
<p>I was wondering if it's possible to link FPC object files by
using the $Link directive? At least I have troubles in getting
this to work and therefore I'm asking here. Please consider the
minimal example I have attached to this email.</p>
<p>When linking the object file that implements the test_proc
procedure I get the following compiler output:</p>
<p>Hint: Start of reading config file
C:\lazarus\fpc\2.6.2\bin\x86_64-win64\fpc.cfg<br>
Hint: End of reading config file
C:\lazarus\fpc\2.6.2\bin\x86_64-win64\fpc.cfg<br>
Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64<br>
Copyright (c) 1993-2012 by Florian Klaempfl and others<br>
Target OS: Win64 for x64<br>
Compiling test.pp<br>
Linking test.exe<br>
test.pp(8,1) Error: Undefined symbol: TEST_INT_TEST_PROC<br>
test.pp(8,1) Fatal: There were 1 errors compiling module,
stopping</p>
<p>What is needed in the test_impl.pas file so the linker can find
the implemented function? Do I need to create a library and
export the function perhaps?</p>
<p>Regards, Darius Blaszyk</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br>
</body>
</html>