<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Bonjour,<br>
<br>
Je vous joins un code Scilab qui fonctionne, avec un morceau de C
compilé a la volée par Scilab.<br>
Si 'res' est votre variable de retour dans AddInt, alors il est en
position 3 dans la séquence d'appel et doit<br>
se trouver après le "out" dans l'appel a call.<br>
<br>
Bonne reception<br>
<br>
//=================== Code Scilab ======================<br>
<br>
cd TMPDIR;<br>
//Code C<br>
f1=['#include <stdint.h><stdint.h>'<br>
'void AddInt(int32_t *a, int32_t *b, int32_t *res)'
<br>
'{'<br>
' *res = *a + *b;'<br>
'}'];<br>
<br>
//Ecriture dans un fichier<br>
mputl(f1, 'AddInt.c')<br>
// Creation de la librairie en code Scilab<br>
ilib_for_link('AddInt', 'AddInt.c',[],"c")<br>
// Chargement de la librairie<br>
exec loader.sce<br>
<br>
a = 2;<br>
b = 4;<br>
// Entrees:<br>
// a est un entier 'i' a la position 1<br>
// b est un entier 'i' a la position 2<br>
// Sorties:<br>
// res est un entier 'i' a la position 3 de taille 1x1<br>
res = call("AddInt",a,1,"i",b,2,"i","out",[1,1],3,"i");<br>
disp(res)
</stdint.h><br>
<br>
//===================================================<br>
<br>
On 07/30/2013 12:52 PM, Thierry ROYANT wrote:<br>
</div>
<blockquote
cite="mid:1757713012.8979.1375181530091.JavaMail.www@wwinf1f13"
type="cite"><span style="font-family: 'Times New Roman';
font-size: medium;">Je souhaite développer une partie
acquisition de données (DAQ) en utilisant une Dll créée avec
LabVIEW.</span>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">Je commence au plus simple, en essayant
d'utiliser une fonction d'addition de 2 entiers, sans succès :</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">le chargement de la bibliothèque semble ok
(link)</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">mais blocage au niveau de l'appel de la
fonction (call) </div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">le protype de ma fonction est :</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">
<p class="MsoPlainText"><span style="font-family: 'Courier
New';">void __cdecl AddInt(int32_t *a, int32_t *b, int32_t
*res);</span></p>
</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;"> </div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">si quelqu'un a déjà fait cette manip? </div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">peut-être est-ce un simple problème de
paramétrage de la fonction call.</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;"> </div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">exemples de retours :</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">1°)</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">
<div style="min-height: 1em;">-->call('AddInt',a,b,res)</div>
<div style="min-height: 1em;">Warning !!!</div>
<div style="min-height: 1em;">Scilab has found a critical error
(EXCEPTION_ACCESS_VIOLATION)</div>
<div style="min-height: 1em;">with "call" function.</div>
<div style="min-height: 1em;">Save your data and restart Scilab.</div>
<div style="min-height: 1em;"> ans =</div>
<div style="min-height: 1em;"> </div>
<div style="min-height: 1em;"> 5. </div>
<div style="min-height: 1em;"> </div>
<div style="min-height: 1em;">Attention: problème avec la pile
... nettoyé.</div>
</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;"> </div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">2°)</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">
<div style="min-height: 1em;">-->call('AddInt',a,1,"i",b,2,"i",res,3,"i","out",[1,1],4,"i")</div>
<div style="min-height: 1em;"> ans =</div>
<div style="min-height: 1em;"> </div>
<div style="min-height: 1em;"> - 11. </div>
<div style="min-height: 1em;"> le résultat n'est pas correct
(-11 tout le temps, quels que soient a et b)</div>
</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;"> </div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">merci d'avance</div>
<div style="min-height: 1em; font-family: 'Times New Roman';
font-size: medium;">TR</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
enseignement mailing list
<a class="moz-txt-link-abbreviated" href="mailto:enseignement@lists.scilab.org">enseignement@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/enseignement">http://lists.scilab.org/mailman/listinfo/enseignement</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Bruno JOFRET
Software Architect
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
<a class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a>
</pre>
</body>
</html>