<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[C++ Builder Lib mit Visual C++]]></title><description><![CDATA[<p>ich habe eine DLL datei geschrieben und diese mit dem C++ Builder compiliert. die Lib datei die nur die exportierten symbole enthält läuft nun unter Visual C++ nicht. was kann ich tun das es doch funktioniert?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/79106/c-builder-lib-mit-visual-c</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 00:58:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/79106.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Jul 2004 23:04:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Wed, 07 Jul 2004 23:04:40 GMT]]></title><description><![CDATA[<p>ich habe eine DLL datei geschrieben und diese mit dem C++ Builder compiliert. die Lib datei die nur die exportierten symbole enthält läuft nun unter Visual C++ nicht. was kann ich tun das es doch funktioniert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555670</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555670</guid><dc:creator><![CDATA[flanderson]]></dc:creator><pubDate>Wed, 07 Jul 2004 23:04:40 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Thu, 08 Jul 2004 04:50:05 GMT]]></title><description><![CDATA[<p>Son Zufall, habe ich gestern Zufällig gegoogelt und gespeichert.</p>
<blockquote>
<p>Linking a Borland DLL with Microsoft Visual C++ v43173 Linking a Borland DLL<br />
with Microsoft Visual C++ v4<br />
Last update 02/03/97</p>
<p>NUMBER : 3173<br />
PRODUCT : Borland C++<br />
VERSION : 5.0<br />
OS : All<br />
DATE : January 3, 1997</p>
<h1>Linking a Borland DLL with Microsoft Visual C++ v4.0</h1>
<h1>Preface</h1>
<p>This document is intended to assist developers in working with<br />
both Borland C++ and<br />
Microsoft Visual C++. Specifically, it covers using DLLs built<br />
with Borland C++ with<br />
Microsoft Visual C++ version 4.0.</p>
<h1>Important Notes</h1>
<p>1. The Microsoft Visual C++ (MSVC) Compiler is case sensitive<br />
and this cannot be<br />
changed by a switch or IDE option. Borland C++ 5.0 (BC5) as well<br />
as previous versions<br />
of Borland C++ provide an option inside the Integrated<br />
Development Environment (IDE)<br />
to toggle case sensitivity in the linking phase. The &quot;case<br />
sensitive link&quot; option in BC5's<br />
IDE must be turned on to force creation of a DLL or .LIB file<br />
that may be linked to by<br />
the MSVC linker. This option is located under the<br />
Options|Project|Linker|General menu<br />
selection.</p>
<p>2. MSVC always generates underscores as the first byte of a<br />
function name. This cannot<br />
be changed by a switch or IDE option. Borland C++ 5.0 provides<br />
an option for this. The<br />
&quot;generate underscores&quot; option must be turned on in the BC5 IDE<br />
when compiling/linking<br />
the DLL code. The option is located under the<br />
Options|Project|Compiler Output menu<br />
inside the IDE.</p>
<p>3. Inside the Borland C++ IDE, specify &quot;C Calling Convention&quot;<br />
IDE for this DLL. This<br />
option is located under the Options|Project|16-bit<br />
Compiler|Calling Convention or the<br />
Options|Project|32-bit Compiler|Calling Convention menu item<br />
accordingly. In the<br />
MSVC IDE, specify &quot;cdecl&quot; calling convention.</p>
<h1>If No Source is Available for the DLL:</h1>
<p>If you do not have the source to the Borland DLL, you may not<br />
know the calling<br />
convention used when it was built. &quot;C Calling Convention&quot; is<br />
probably the most<br />
common calling convention. Borland provides a utility to create<br />
a .LIB file from a DLL.<br />
This program is called &quot;IMPLIB.&quot; Use this command with the &quot;-c&quot;<br />
switch to generate a<br />
.LIB file with case-sensitive symbols. You can then browse the<br />
.LIB file and look for<br />
your function names. They will appear in the .LIB file with<br />
names similar to the<br />
following example:</p>
<p>__imp__FunctionName</p>
<p>This means that when the DLL was built &quot;declspec(dllexport)&quot; was<br />
used when defining<br />
the functions and their prototypes. Build a .DEF file from this<br />
.LIB file as in the<br />
examples below. Next, build a new .LIB using the Microsoft LIB<br />
utility, and use this<br />
with the MSVC compiler.</p>
<p>If the function names in the .LIB do not look like the example<br />
above, some other calling<br />
convention was used. It will take a considerable amount of work<br />
to discover how it was<br />
built. Refer to Microsoft Knowledgebase article # Q131313 for<br />
some help with this<br />
process.</p>
<h1>If the DLL Source is Available:</h1>
<p>Be sure that the options described in items 1, 2 and 3 above are<br />
set correctly in both<br />
development environments. Next, change all of the exportable<br />
functions in the DLL by<br />
putting &quot;declspec(dllexport)&quot; in front of the function<br />
definition.</p>
<p>In the header file for the DLL, include some code as in the<br />
example below:</p>
<p>#ifndef _SAMPLE_H<br />
#define _SAMPLE_H</p>
<p>#ifdef EXPNETFUNCS<br />
#define EXPNETTYPE __declspec( dllexport )<br />
#else<br />
#define EXPNETTYPE __declspec( dllimport )<br />
#endif EXPNETFUNCS</p>
<p>#ifdef __cplusplus<br />
extern &quot;C&quot; {<br />
#endif<br />
EXPNETTYPE SHORT WINAPI BeginNetworkOps(int);<br />
EXPNETTYPE SHORT WINAPI EndNetworkOps(SHORT);<br />
#ifdef __cplusplus<br />
}<br />
#endif<br />
#endif</p>
<p>In the DLL source code, where the header file is included,<br />
#define EXPNETFUNCS and<br />
the correct prototype will be generated. In the application<br />
program that includes this<br />
header file, DO NOT define EXPNETFUNCS and the correct code will<br />
be generated<br />
there. Don't forget to put 'extern &quot;C&quot; {' around these functions<br />
in the header file for the<br />
DLL, if this DLL is written in C++. This prevents C++'s name<br />
decorations for these<br />
functions and keeps the name the same so external programs can<br />
link with them.</p>
<p>Now rebuild the DLL. Use Borland's IMPDEF command to generate a<br />
.DEF file. Use<br />
the following command to generate a .DEF file:</p>
<p>IMPDEF c:\msproj\sample.def c:\bcproj\sample.dll</p>
<p>Do not use the &quot;-h&quot; switch for the IMPDEF command. MSVC does not<br />
use any &quot;hints&quot;<br />
when processing .DEF files. Next, use the Microsoft LIB command<br />
to generate a .LIB<br />
file from the .DEF file created above. The following command<br />
will generate the LIB<br />
file:</p>
<p>LIB /def:c:\msproj\sample.def /out:c:\msproj\sample.lib</p>
<p>Include this lib file in the MSVC project. Then compile and link<br />
it. It will fail in the link<br />
step due to unresolved external references. Nevertheless, the<br />
error messages provide<br />
some very important information. The error messages in MSVC 4.0<br />
will look like the<br />
following:</p>
<p>MSSAMPLE.OBJ : error LNK2001: unresolved external symbol<br />
__imp__BeginNetworkOps@12<br />
MSSAMPLE.OBJ : error LNK2001: unresolved external symbol<br />
__imp__EndNetworkOps@8</p>
<p>The &quot;@&quot; following the function name in the error message has a<br />
number after it. This<br />
number represents the number of bytes that the linker reserves in<br />
the stack for arguments<br />
passed to the function. MSVC 4.0 uses this number and the &quot;@&quot;<br />
sign as part of the<br />
function names You cannot prevent that from happening if you use<br />
the cdecl calling<br />
convention. This is why you get the unresolved reference; it<br />
actually does not exist in<br />
the .LIB file.</p>
<p>To fix this problem edit the .DEF file created in a previous<br />
step, and add the &quot;@&quot; sign<br />
and the number to the end of the exported function names. Try to<br />
recompile the MSVC<br />
application again. It should link properly. The linker strips<br />
off the &quot;@n&quot; on the function<br />
names when it produces the executable file, and it will find the<br />
function in the DLL at<br />
run time.</p>
<h1>Knowledge Base Documents</h1>
<p>The Microsoft Knowledge Base document Q131313 referred to earlier<br />
is titled &quot;How to<br />
Create 32-bit Import Libraries Without .OBJs or Source.&quot;<br />
Knowledge Base documents<br />
are available from the Microsoft Support Web page<br />
<a href="http://www.microsoft.com/support/" rel="nofollow">http://www.microsoft.com/support/</a>.</p>
<p>DISCLAIMER: You have the right to use this technical information<br />
subject to the terms of the No-Nonsense License Statement that<br />
you received with the Borland product to which this information<br />
pertains.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/555692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555692</guid><dc:creator><![CDATA[Marmey]]></dc:creator><pubDate>Thu, 08 Jul 2004 04:50:05 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Thu, 08 Jul 2004 13:34:32 GMT]]></title><description><![CDATA[<p>danke marmey das scheint was zu sein.<br />
also ich möchte folgendes damit es wirklich klar ist:</p>
<p>1. mit dem CBuilder code ich eine DLL dynamisch<br />
2. mit dem Visual C++ 6.0 code ich ein anderes projekt, da möchte ich dann die DLL die ich mit CBuilder compiliert habe, nutzen. Dazu füge ich die 256 bytes grosse Lib vom CBuilder erstellt, dem VC projekt hinzu. diese Lib ist hald klein da sie echt nur die exportierten symbole enthält und nicht etwa die ganze DLL als lib. gut, dieser abschnitt dürfte interessat sein:</p>
<blockquote>
<p>1. The Microsoft Visual C++ (MSVC) Compiler is case sensitive<br />
and this cannot be<br />
changed by a switch or IDE option. Borland C++ 5.0 (BC5) as well<br />
as previous versions<br />
of Borland C++ provide an option inside the Integrated<br />
Development Environment (IDE)<br />
to toggle case sensitivity in the linking phase. The &quot;case<br />
sensitive link&quot; option in BC5's<br />
IDE must be turned on to force creation of a DLL or .LIB file<br />
that may be linked to by<br />
the MSVC linker. This option is located under the<br />
Options|Project|Linker|General menu<br />
selection.</p>
<p>2. MSVC always generates underscores as the first byte of a<br />
function name. This cannot<br />
be changed by a switch or IDE option. Borland C++ 5.0 provides<br />
an option for this. The<br />
&quot;generate underscores&quot; option must be turned on in the BC5 IDE<br />
when compiling/linking<br />
the DLL code. The option is located under the<br />
Options|Project|Compiler Output menu<br />
inside the IDE.</p>
<p>3. Inside the Borland C++ IDE, specify &quot;C Calling Convention&quot;<br />
IDE for this DLL. This<br />
option is located under the Options|Project|16-bit<br />
Compiler|Calling Convention or the<br />
Options|Project|32-bit Compiler|Calling Convention menu item<br />
accordingly. In the<br />
MSVC IDE, specify &quot;cdecl&quot; calling convention.</p>
</blockquote>
<p>allerdings finde ich keiner dieser optionen im CBuilder optionenmenu. was nun?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/556085</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556085</guid><dc:creator><![CDATA[flanderson]]></dc:creator><pubDate>Thu, 08 Jul 2004 13:34:32 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Thu, 08 Jul 2004 13:42:18 GMT]]></title><description><![CDATA[<p>obwohl doch. nur punkt 1 nicht.</p>
<p>1. = ???<br />
2. müsste sein: &quot;Unterstriche erzeugen / JA&quot;<br />
3. müsste sein: &quot;Aufrufkonvention / C&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/556095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556095</guid><dc:creator><![CDATA[flanderson]]></dc:creator><pubDate>Thu, 08 Jul 2004 13:42:18 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Thu, 08 Jul 2004 14:36:51 GMT]]></title><description><![CDATA[<p>habe die lib datei nun mit implib erstellt. jetzt ist sie 1kB gross, geht mit dem VC aber immer noch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>ständig: engine.lib : fatal error LNK1136: invalid or corrupt file</p>
]]></description><link>https://www.c-plusplus.net/forum/post/556150</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556150</guid><dc:creator><![CDATA[flanderson]]></dc:creator><pubDate>Thu, 08 Jul 2004 14:36:51 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Thu, 08 Jul 2004 21:11:54 GMT]]></title><description><![CDATA[<p>Mehr helfen, wie den gefunden Artikel posten (Marmey bin ich unangemeldet), kann ich dir eigentlich auch nicht. Aber hast du dir auch wirklich alles durchgelesen?</p>
<blockquote>
<h1>If No Source is Available for the DLL:</h1>
<p>If you do not have the source to the Borland DLL, you may not<br />
know the calling<br />
convention used when it was built. &quot;C Calling Convention&quot; is<br />
probably the most<br />
common calling convention. Borland provides a utility to create<br />
a .LIB file from a DLL.<br />
This program is called &quot;IMPLIB.&quot; Use this command with the &quot;-c&quot;<br />
switch to generate a<br />
.LIB file with case-sensitive symbols. You can then browse the<br />
.LIB file and look for<br />
your function names. They will appear in the .LIB file with<br />
names similar to the<br />
following example:</p>
<p>__imp__FunctionName</p>
<p>This means that when the DLL was built &quot;declspec(dllexport)&quot; was<br />
used when defining<br />
the functions and their prototypes. Build a .DEF file from this<br />
.LIB file as in the<br />
examples below. Next, build a new .LIB using the Microsoft LIB<br />
utility, and use this<br />
with the MSVC compiler.</p>
<p>If the function names in the .LIB do not look like the example<br />
above, some other calling<br />
convention was used. It will take a considerable amount of work<br />
to discover how it was<br />
built. Refer to Microsoft Knowledgebase article # Q131313 for<br />
some help with this<br />
process.</p>
</blockquote>
<p>Das scheint ja in dem Zusammenhang das du die Lib mit Implib erstellst wichtig zu sein und deine Aussage klingt nicht so als hättest du das gemacht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/556458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556458</guid><dc:creator><![CDATA[Bigwill]]></dc:creator><pubDate>Thu, 08 Jul 2004 21:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Fri, 09 Jul 2004 15:04:54 GMT]]></title><description><![CDATA[<p>habs nun doch geschafft. ich musste zuerst seitens borland mit impdef eine def der dll erstellen. anhand dieser def dann seitens microsoft mit LIB die eigentliche lib erstellen.</p>
<p>ABER jetzt krieg ich nen linker error das die symbole nicht aufgelöst sind??? so ne scheisse ich kack noch ab <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>error LNK2001: unresolved external symbol __imp__Start_Vote<br />
.\Profilemp/mode.dll : fatal error LNK1120: 1 unresolved externals<br />
Error executing link.exe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/556935</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556935</guid><dc:creator><![CDATA[flanderson]]></dc:creator><pubDate>Fri, 09 Jul 2004 15:04:54 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Builder Lib mit Visual C++ on Fri, 09 Jul 2004 15:07:24 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">Meine DLL
extern &quot;C&quot; __declspec(dllexport) void Start_Vote(int);

Funktion: void Start_Vote(int Num){//.....}

Die andere DLL
extern &quot;C&quot; __declspec(dllimport) void Start_Vote(int);

Aufruf: Start_Vote(677);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/556940</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556940</guid><dc:creator><![CDATA[flanderson]]></dc:creator><pubDate>Fri, 09 Jul 2004 15:07:24 GMT</pubDate></item></channel></rss>