Re :Problem with Compiling C function

"Maciej Grygorcewicz" <[email protected]> Mon, 14 Jan 2008 23:26:21 +0100
Newsgroups gmane.comp.db.postgresql.cygwin
Message-ID <[email protected]>
------=_Part_7094_29728084.1200349581104
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

2008/1/9, Maciej Grygorcewicz :
>> But linker threw such errors:
> >"
>>  Unresolved External: _pgwin32_fopen referended from .... // and so on
>  >Unresolved External: _pg_sprintfl referended from .... // and so on "
>>
>> Why???? I have included postgres.h , and all other required files .

>-lpgport is needed.

Thanks for the response. But I have few questions
Is this a compiler / linker switch . Can I turn it on on Builder . or have I
to use gcc or g++??

> I tried to build almost the same code but in C++ style DLL.
> DLL file was created succesfully , but on the other hand postgreSQL
couldn't
> find exported function...
> DLL was in non-undernstadable format for postgresql.

>for c++ you have to wrap the postgresql functions into extern "C".
Yes , I am wrapping exported functions in extern "C" . But it doesn't work.
Maybe I have to wrapp all functions , but this is  never ending work - I
have in project many files from Jpeglib library...
-- 
Pozdrawiam

Maciej Grygorcewicz
[email protected] ,
[email protected]
GG 1638280

------=_Part_7094_29728084.1200349581104
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div style="direction: ltr;">2008/1/9, Maciej Grygorcewicz :<br></div><div style="direction: ltr;"><span class="q">&gt;&gt; But linker threw such errors:<br>&gt; &gt;&quot;<br>&gt;&gt;&nbsp; Unresolved External: _pgwin32_fopen referended from .... // and so on
<br>&gt;&nbsp; &gt;Unresolved External: _pg_sprintfl referended from .... // and so on &quot;<br>&gt;&gt;<br>&gt;&gt; Why???? I have included postgres.h , and all other required files .<br><br></span></div><div style="direction: ltr;">
&gt;-lpgport is needed.<br><br>Thanks for the response. But I have few questions<br>Is this a compiler / linker switch . Can I turn it on on Builder . or have I to use gcc or g++??<br></div><div style="direction: ltr;"><span class="q">
<br>&gt; I tried to build almost the same code but in C++ style DLL.<br>&gt; DLL file was created succesfully , but on the other hand postgreSQL couldn&#39;t<br>&gt; find exported function...<br>&gt; DLL was in non-undernstadable format for postgresql.
<br><br></span></div>&gt;for c++ you have to wrap the postgresql functions into extern &quot;C&quot;.<br clear="all">Yes , I am wrapping exported functions in extern &quot;C&quot; . But it doesn&#39;t work.<br>Maybe I have to wrapp all functions , but this is&nbsp; never ending work - I have in project many files from Jpeglib library...
<br>-- <br>Pozdrawiam<br><br>Maciej Grygorcewicz<br><a href="mailto:[email protected]" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">[email protected]</a> ,<br><a href="mailto:[email protected]" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
[email protected]</a><br>GG 1638280

------=_Part_7094_29728084.1200349581104--