<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718907</guid>
        <pubDate>Mon, 16 May 2005 14:14:15 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718907</link>
        <description><![CDATA[nash: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>утверждение ложное, не проверил, а советуешь</div></div><br>
что проверять когда C-ый int - это VB-ый Long.<br>
Уже здесь ошибка. Может еще в чем.<br>
Кстати, это ты советуешь во втором посте передавать по ссылке, когда сразу видно, что там по значению  :D]]></description>
        <author>nash</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718826</guid>
        <pubDate>Mon, 16 May 2005 13:29:38 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718826</link>
        <description><![CDATA[Mr. Greg: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=95025&view=findpost&p=718668'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>nash &#064; <time class="tag-quote__quoted-time" datetime="2005-05-16T12:07:25+00:00">16.05.05, 12:07</time></span><div class='quote '>и все ок будет</div></div><br>
утверждение ложное, не проверил, а советуешь :angry: <br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=95025&view=findpost&p=718668'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Алиса &#064; <time class="tag-quote__quoted-time" datetime="2005-05-16T12:07:25+00:00">16.05.05, 12:07</time></span><div class='quote '>убрать декорирование имен</div></div><br>
однако, полезно предыдущие ответы посмотреть - в ссылке об этом есть.]]></description>
        <author>Mr. Greg</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718668</guid>
        <pubDate>Mon, 16 May 2005 12:07:25 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718668</link>
        <description><![CDATA[Алиса: Используй def-файл, чтобы убрать декорирование имен. <br>Тогда будет не &quot;?mfcfun@@YAXH@Z&quot;, а &quot;mfcfun&quot;<br>Достаточно в этом файле прописать<br>EXPORT:<br>  mfcfun]]></description>
        <author>Алиса</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718655</guid>
        <pubDate>Mon, 16 May 2005 11:58:31 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718655</link>
        <description><![CDATA[nash: Private Declare Sub mfcfun _<br>
  Lib &quot;C:&#092;work&#092;access&#092;mfcdll.dll&quot; _<br>
  Alias &quot;?mfcfun@@YAXH@Z&quot; _<br>
  (ByVal n As <strong class='tag-b'>LONG</strong>)<br>
<br>
и все ок будет]]></description>
        <author>nash</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718452</guid>
        <pubDate>Mon, 16 May 2005 10:01:17 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718452</link>
        <description><![CDATA[sq_deep: Да, вы правы.]]></description>
        <author>sq_deep</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718389</guid>
        <pubDate>Mon, 16 May 2005 09:26:22 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718389</link>
        <description><![CDATA[Old Bat: IMHO :no: к VB, и, в том числе, к VBA. В теме не рассматриваются особенности именно VBA-кода (см. пост #6)]]></description>
        <author>Old Bat</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718309</guid>
        <pubDate>Mon, 16 May 2005 08:42:32 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718309</link>
        <description><![CDATA[sq_deep: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=95025&view=findpost&p=718134'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Old Bat &#064; <time class="tag-quote__quoted-time" datetime="2005-05-16T07:06:44+00:00">16.05.05, 07:06</time></span><div class='quote '>Тема перемещена из раздела VB for Application</div></div>Вам, конечно, виднее, уважаемый <strong class='tag-b'>Old Bat</strong>, но мне почему-то кажется, что вопрос &quot;как вызвать функцию из DLL в программе, написанной на VBA?&quot; всё-таки относится именно к VBA, у не к каким-то там &quot;общим вопросам&quot;...]]></description>
        <author>sq_deep</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718134</guid>
        <pubDate>Mon, 16 May 2005 07:06:44 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718134</link>
        <description><![CDATA[Old Bat: <div class="tag-mod"><div class="tag-mod__prefix">M</div><div class="tag-mod__body">Тема перемещена из раздела <a class='tag-url' href='http&#58;//forum.sources.ru/index.php?showforum=20' target='_blank'>VB for Application</a></div></div>]]></description>
        <author>Old Bat</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718070</guid>
        <pubDate>Mon, 16 May 2005 06:00:27 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=718070</link>
        <description><![CDATA[sq_deep: Спасибо, <strong class='tag-b'>Mr. Greg</strong>. Надо действительно писать <strong class='tag-b'>__stdcall</strong> (или <strong class='tag-b'>PASCAL</strong>):<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">__declspec(dllexport) void __stdcall mfcfun(int n) {...}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>sq_deep</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=717474</guid>
        <pubDate>Sun, 15 May 2005 14:05:40 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=717474</link>
        <description><![CDATA[nikf: попробуй вместо void поюзать инт.. ноль возвратишь и ладно.. басике инт на лонг надо менять...]]></description>
        <author>nikf</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716973</guid>
        <pubDate>Sun, 15 May 2005 03:27:29 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716973</link>
        <description><![CDATA[Mr. Greg: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>The C++ project must also be set to use the __stdcall calling convention. Otherwise you will get error 49 &quot;Bad DLL Calling Convention&quot;. The issue there is that C++ and VB natively push arguments on the stack in different manner. But when you tell Visual C++ (presumable could do the same w/ Borland or another compiler) to use the __stdcall convention it makes it so your VB program can read it.</div></div><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">__stdcall</div></ol></div></div></div></div><br>
надо использовать, тем более если тип данных не определен<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">void</div></ol></div></div></div></div>, с VB так нельзя.<br>
зы. проект перекомпиленный в vc 6 ведет себя также :( <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-05-15T03:28:42+00:00">15.05.05, 03:28</time></span></span><br>
<a class='tag-url' href='http://www.geocities.com/firepower_50ae/CodeNote/CppVBDLL.html' target='_blank'>VC DLL in VB</a>]]></description>
        <author>Mr. Greg</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716398</guid>
        <pubDate>Sat, 14 May 2005 14:25:21 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716398</link>
        <description><![CDATA[sq_deep: Вот rar.<br><br>В нём проект на VC++ v7.0.<br><br>В папках Debug&#092; и Release&#092; соответственно отладочная и релизная DLL. Обе ведут себя одинаково. Функция вызывается, параметр передаётся правильно, но потом ошибка 49...<br><br>Моя реальная DLL делает, конечно, гораздо больше всего интересного, но эта тестовая ведёт себя так же.]]></description>
        <author>sq_deep</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716308</guid>
        <pubDate>Sat, 14 May 2005 12:57:10 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716308</link>
        <description><![CDATA[Mr. Greg: Скинь длл]]></description>
        <author>Mr. Greg</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716300</guid>
        <pubDate>Sat, 14 May 2005 12:52:46 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716300</link>
        <description><![CDATA[sq_deep: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=95025&view=findpost&p=716019'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Mr. Greg &#064; <time class="tag-quote__quoted-time" datetime="2005-05-14T09:42:55+00:00">14.05.05, 09:42</time></span><div class='quote '>Попробуй убрать ByVal</div></div>Нельзя. Тогда должно будет стать<br>
mfcfun(int<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>*</strong></span> n), а мне надо без &quot;*&quot;...]]></description>
        <author>sq_deep</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716019</guid>
        <pubDate>Sat, 14 May 2005 09:42:55 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716019</link>
        <description><![CDATA[Mr. Greg: Попробуй убрать <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">ByVal</div></ol></div></div></div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-05-14T09:55:45+00:00">14.05.05, 09:55</time></span></span><br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '><strong class='tag-b'>Bad DLL Calling Convention Error</strong><br>
This error is often caused by incorrectly omitting or including the ByVal keyword from the Declare statement. This error can also be caused if the wrong parameters are passed.</div></div>]]></description>
        <author>Mr. Greg</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716010</guid>
        <pubDate>Sat, 14 May 2005 09:35:17 +0000</pubDate>
        <title>Bad DLL calling convention</title>
        <link>https://forum.sources.ru/index.php?showtopic=95025&amp;view=findpost&amp;p=716010</link>
        <description><![CDATA[sq_deep: Господа, помогите, пожалуйста, избавиться от <strong class='tag-b'>Run-time error 49</strong> (Bad DLL calling convention). Ситуация такая.<br>
<br>
У меня есть MFC DLL, которую я сделал на MSVC++ v7. В ней функция<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">__declspec(dllexport) void mfcfun(int n) {...}</div></ol></div></div></div></div>Я её вызываю из MS Access следующим кодом<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Private Declare Sub mfcfun _</div><div class="code_line">&nbsp;&nbsp;Lib &quot;C:\work\access\mfcdll.dll&quot; _</div><div class="code_line">&nbsp;&nbsp;Alias &quot;?mfcfun@@YAXH@Z&quot; _</div><div class="code_line">&nbsp;&nbsp;(ByVal n As Integer)</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub testDLL()</div><div class="code_line">&nbsp;&nbsp; &nbsp;mfcfun 33</div><div class="code_line">End Sub</div></ol></div></div></div></div>Она нормально вызывается, но выдаёт после выхода эту самую ошибку 49.<br>
<br>
Конечно, можно поставить<br>
On Error Resume Next<br>
но только боюсь, это приведёт рано или поздно к каким-нибудь проблемам.<br>
<br>
<strong class='tag-b'>Что посоветуете?</strong><br>
<br>
PS на CodeNet.ru никто не знает, похоже...]]></description>
        <author>sq_deep</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      </channel>
      </rss>
	