[Scilab-users] ilib_for_link problems using c++

chrisd87 c17 at gmx.net
Fri Aug 23 10:44:38 CEST 2013


Hi!

I have some c++ files that i want to link in scilab for better testing. I
first tried using the example on the ilib_for_link help page (
http://help.scilab.org/docs/5.4.1/en_US/ilib_for_link.html
<http://help.scilab.org/docs/5.4.1/en_US/ilib_for_link.html>  ). It worked
with c.
When i changed the filename to .cpp, following error occured:

-----------------------------------------------------------------------

-->exec('D:\test_sci2.sce', -1)
   erzeuge eine Laderdatei
   erzeuge ein Makefile
   Führe Makefile aus
   Kompilation von fun1.obj
   erzeuge eine gemeisame Bibliothek (habe Sie Geduld)
   erzeuge eine Cleanerdatei
 
-->// This file is released under the 3-clause BSD license. See COPYING-BSD.
 
-->// Generated by builder.sce : Please, do not edit this file
 
-->//
----------------------------------------------------------------------------
 
-->//
 
-->if ~win64() then
-->  warning(_("This module requires a Windows x64 platform."));
-->  return
-->end
 
-->//
 
-->ext1c_path = get_absolute_file_path('loader.sce');
 
-->//
 
-->// ulink previous function with same name
 
-->[bOK, ilib] = c_link('ext1c');
 
-->if bOK then
-->  ulink(ilib);
-->end
 
-->//
 
-->link(ext1c_path + 'libext1c' + getdynlibext(), ['ext1c'],'c');
gemeinsame Bibliothek geladen.
Verkettung durchgeführt.
ext1c ist kein Eingangspunkt.
dynlibext(), ['ext1c'],'c')
                            !--error 235 
link: Problem mit einer der Eingangspunkte.
at line      18 of exec file called by :    
exec loader.sce
at line      19 of exec file called by :    
exec('D:\test_sci2.sce', -1)

---------------------------------------------------------------------------

My System:
Windows 7 x64
Scilab 5.4.0 64-Bit
MinGw toolbox 0.9.3
I use the recommended Compiler for MinGW Toolbox: gcc-4.6.3-64

---------------------------------------------------------------------------

The code i ran is:

if haveacompiler() then

chdir(TMPDIR)
f1=['int ext1c(int *n, double *a, double *b, double *c)'
    '{int k;'
    '  for (k = 0; k < *n; ++k) '
    '      c[k] = a[k] + b[k];'
    '  return(0);}'];

mputl(f1,'fun1.cpp')

//creating the shared library (a gateway, a Makefile and a loader are
//generated.

ilib_for_link('ext1c','fun1.cpp',[],"c")

// load the shared library

exec loader.sce

//using the new primitive
a=[1,2,3];b=[4,5,6];n=3;
c=call('ext1c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
if norm(c-(a+b)) > %eps then pause,end

end

----------------------------------------------------------------------

Thank you very much for your help in advance!

Best regards,
Christopher




--
View this message in context: http://mailinglists.scilab.org/ilib-for-link-problems-using-c-tp4027270.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list