<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling C++ DLL from SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283279#M57737</link>
    <description>&lt;P&gt;Thanks Jan. Tried it, and now reveals another error. i.e. not a valid&amp;nbsp;Win32 application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran this code on SAS Foundations 64 bit in windows. The dll is compiled 32 bit. I am confused now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. This error is stated after the "Unable to load 'myExcelDll.dll' error. So is SAS able to read the dll and find that its not a valid&amp;nbsp;Win32 application thus throwing the 2 errors?&lt;/P&gt;&lt;P&gt;2. The dll was compiled as 32 bit. Still why does SAS complain?&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;The first warning of STDCALL option being supported only on PC platform (which I assume means Windows??). If it does then this warning does not make sense since I am running&amp;nbsp;SAS on Windows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: STDCALL option is only supported on the PC platform.
ERROR: Unable to load 'myExcelDll.dll'.
ERROR: Fehler beim Laden der Extension: OS-Fehler: 193 (E:\C++\myExcelDll\Release\myExcelDll.dll
is not a valid Win32 application.)
ERROR: Extension kann nicht geladen werden: (E:\C++\myExcelDll\Release\myExcelDll.dll)
ERROR: Extension nicht gefunden: myExcelDll.dll
ERROR: Extension nicht gefunden: myExcelDll.dll
NOTE: Prototypes saved to LIB.PROTO_DS.CFCNS.
NOTE: PROCEDURE PROTO used (Total process time):
      real time           0.05 seconds
      cpu time            0.04 seconds&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jul 2016 11:58:32 GMT</pubDate>
    <dc:creator>andrnev</dc:creator>
    <dc:date>2016-07-11T11:58:32Z</dc:date>
    <item>
      <title>Calling C++ DLL from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283260#M57726</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried one method of calling a C++ dll created in Visual Studio 2010.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myexceldll.cpp&lt;/P&gt;&lt;PRE&gt;int __stdcall myPower(int myValue)
{
return myValue * myValue;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;defFile.def&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;LIBRARY "myExcelDll"
EXPORTS
myPower @1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;When trying to load the dll in SAS Enterprise guide 5.1 or even in SAS foundations 9.3 I get the following error&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;15 %let root=E:\C++\myExcelDll\Release;

16 libname lib "&amp;amp;root";

NOTE: Libref LIB was successfully assigned as follows:

Engine: V9

Physical Name: E:\C++\myExcelDll\Release

17

18 proc proto package=lib.Proto_ds.cfcns stdcall;

19 link '&amp;amp;root\myExcelDll.dll';

20

21 run;

WARNING: STDCALL option is only supported on the PC platform.

ERROR: Unable to load 'myExcelDll.dll'.

ERROR: Extension nicht gefunden: &amp;amp;root\myExcelDll.dll

ERROR: Extension nicht gefunden: myExcelDll.dll

ERROR: Extension nicht gefunden: myExcelDll.dll

ERROR: Datei LIB.PROTO_DS kann nicht aktualisiert werden. Die Codierung stimmt nicht mit der Codierung der Sitzung überein, oder

die Datei besitzt das systemeigene Format eines anderen Hosts, z.B. WINDOWS_64.

NOTE: PROZEDUR PROTO used (Total process time):

real time 0.04 seconds

cpu time 0.03 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;Any idea what the warning means? I am working on a Windows platform and both Enterprise guide and Foundations are installed on Windows. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;Another issue I looked at was that SAS Foundations was 64 bit whereas my code is a Win32 dll. So I tried to compile with gcc using 64 bit settings and I still get the same error.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 08:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283260#M57726</guid>
      <dc:creator>andrnev</dc:creator>
      <dc:date>2016-07-11T08:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calling C++ DLL from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283264#M57729</link>
      <description>&lt;P&gt;Sorry, no, never found a reason to call C++ dll's (and can be quite dangerous if you don't know what your doing). &amp;nbsp;Why are you needing to do this? &amp;nbsp;SAS offers all the functionality you could need, the only reason I could think of is a historical program that is a requirement, otherwise just do it in SAS, or do it in C++, no need for both.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 09:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283264#M57729</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-11T09:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calling C++ DLL from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283266#M57730</link>
      <description>&lt;P&gt;Yep, I could do it in either. Just an academic question rather.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 09:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283266#M57730</guid>
      <dc:creator>andrnev</dc:creator>
      <dc:date>2016-07-11T09:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calling C++ DLL from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283271#M57734</link>
      <description>&lt;P&gt;In your statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;link '&amp;amp;root\myExcelDll.dll';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you are using single quotes. Therefore &amp;amp;root will not be resolved. Use double quoutes and you will be in much better shape.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;link "&amp;amp;root\myExcelDll.dll";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards, Jan.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 11:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283271#M57734</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-07-11T11:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calling C++ DLL from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283279#M57737</link>
      <description>&lt;P&gt;Thanks Jan. Tried it, and now reveals another error. i.e. not a valid&amp;nbsp;Win32 application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran this code on SAS Foundations 64 bit in windows. The dll is compiled 32 bit. I am confused now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. This error is stated after the "Unable to load 'myExcelDll.dll' error. So is SAS able to read the dll and find that its not a valid&amp;nbsp;Win32 application thus throwing the 2 errors?&lt;/P&gt;&lt;P&gt;2. The dll was compiled as 32 bit. Still why does SAS complain?&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;The first warning of STDCALL option being supported only on PC platform (which I assume means Windows??). If it does then this warning does not make sense since I am running&amp;nbsp;SAS on Windows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: STDCALL option is only supported on the PC platform.
ERROR: Unable to load 'myExcelDll.dll'.
ERROR: Fehler beim Laden der Extension: OS-Fehler: 193 (E:\C++\myExcelDll\Release\myExcelDll.dll
is not a valid Win32 application.)
ERROR: Extension kann nicht geladen werden: (E:\C++\myExcelDll\Release\myExcelDll.dll)
ERROR: Extension nicht gefunden: myExcelDll.dll
ERROR: Extension nicht gefunden: myExcelDll.dll
NOTE: Prototypes saved to LIB.PROTO_DS.CFCNS.
NOTE: PROCEDURE PROTO used (Total process time):
      real time           0.05 seconds
      cpu time            0.04 seconds&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jul 2016 11:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283279#M57737</guid>
      <dc:creator>andrnev</dc:creator>
      <dc:date>2016-07-11T11:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calling C++ DLL from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283287#M57741</link>
      <description>&lt;P&gt;You have typed your answer there, you are trying to run a 32bit compilation on a 64bit system. &amp;nbsp;Some information (it wont solve your problem, but may explain it):&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/" target="_blank"&gt;https://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 12:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-C-DLL-from-SAS/m-p/283287#M57741</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-11T12:43:56Z</dc:date>
    </item>
  </channel>
</rss>

