[Scilab-Dev] How use a custom library in a toolbox ?

Vincent Lejeune vincent.lejeune at institutoptique.fr
Mon May 4 19:49:47 CEST 2009


I've switched to a dll library as adviced, but it didnt solve my problem. 
The error is the same, MSVC cannot find the external link to my function...
Here is attached the .lib and the .dll.

--------------------------------------------------
From: "Allan CORNET" <allan.cornet at scilab.org>
Sent: Monday, May 04, 2009 11:37 AM
To: <dev at lists.scilab.org>
Subject: RE: [Scilab-Dev] How use a custom library in a toolbox ?

> Hi,
>
> First, I advice to use dynamic library for your project it will be easier 
> to
> debug and to support.
>
> From my experience with VS #pragma('lib',libname) works better when
> 'libname' is a dynamic library than a static library.
> For example , your 'libname' can have some others external dependencies 
> and
> you will need to force a link also on these libraries.
>
> A temp. workaround can be :
>
> tbx_build_gateway('skeleton_c', ['c_sum','sci_csum';'c_sub','sci_csub'],
> ['sci_csum.c','sci_csub.c'], ..
>                  get_absolute_file_path('builder_gateway_c.sce'), ..
>                  ['../../src/c/libcsum','libname']);
>
> Where 'libname' is the pathname of your library.
>
> I suspect that your path in #pragma is wrong or that your library does not
> export "_GPU_lu" symbol.
>
> What is built options of your static library ?
> (http://msdn.microsoft.com/fr-fr/library/2kzt1wy3.aspx)
>
> Can you send me your .lib ?
>
>
> Allan
>
> -----Message d'origine-----
> De : Vincent Lejeune [mailto:vincent.lejeune at institutoptique.fr]
> Envoyé : lundi 4 mai 2009 11:08
> À : dev at lists.scilab.org
> Objet : Re: [Scilab-Dev] How use a custom library in a toolbox ?
>
> Hi
> here it is, and the log for the compilation.
> The linker doesnt find where to find my functions actually...
>
> My custom library is in a static .lib, I don't use .dll at the moment.
> (By the way, the link you gave me is broken).
>
> Thank for help, I am no compile process expert...
>
>
> --------------------------------------------------
> From: "Allan CORNET" <allan.cornet at scilab.org>
> Sent: Monday, May 04, 2009 8:17 AM
> To: <dev at lists.scilab.org>
> Subject: RE: [Scilab-Dev] How use a custom library in a toolbox ?
>
>> Hi,
>>
>> Please attach your makelib.mak
>>
>> You can do :
>>
>> exec builder.sce
>> after that your script return a error , put in Scilab :
>> unix start
>> it will open a dos shell
>> nmake /f makelib.mak
>>
>> What is the error message ?
>>
>> What is your .lib is a library import for a dll or a static library  ?
>>
>> You can use external fortran dynamic library.
>> We link blas ,lapack and others fortran libraries to Scilab.
>>
>>
>> http://wiki.scilab.org/How_to_debug_an_external_source_code_linked_to_
>> scilab
>> _with_Visual_Studio
>>
>> Allan CORNET
>>
>>
>>
>>
>>
>> -----Message d'origine-----
>> De : Vincent Lejeune [mailto:vincent.lejeune at institutoptique.fr]
>> Envoyé : dimanche 3 mai 2009 22:42
>> À : dev at lists.scilab.org
>> Objet : [Scilab-Dev] How use a custom library in a toolbox ?
>>
>> Hello,
>>
>> I'd like to make a toolbox for Scilab with source that need to be
>> compiled with nvcc , which is not considered as a common compiler (it
>> makes asm code from cuda source).
>> I made a .lib file containing precompiled functions I liked to use
>> within the gateway part from the squeleton toolbox. That means, I add
>> a #pragma
>> comment(lib,"...") pointing to the .lib file, and the header
>> containing the prototype of my functions. However, the automated
>> script doesnt work, here is the output (in french sorry, only the end
>> does matter anyway) :
>>
>>> Initialisation:
>>>   Chargement de l'environnement de travail
>>>    Génère un fichier loader
>>>    Génère un Makefile
>>>    Exécute le Makefile
>>>    Compilation de csum.c
>>>    Compilation de csub.c
>>>    Construction de la bibliothèque partagée (soyez patient)
>>>    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual
>>> Studio 9.0\VC\bin\link.EXE"'á: code retour '0x450'
>>>    Stop.
>>>  !--error 10000
>>> unix_s: error during "nmake /Y /nologo /f Makelib.mak libcsum.dll"
>>> execution
>>> at line      34 of function unix_s called by :
>>> line    50 of function ilib_compile called by :
>>> line    34 of function ilib_for_link called by :
>>> line    18 of function tbx_build_src called by :
>>> _absolute_file_path('builder_c.sce'))
>>> line     9 of exec file called by :
>>> ktop/TOOLBO~1/src/c/BUILDE~1.SCE'));
>>
>> I'm under windows. It's seems that the linking is failling. How can I
>> embed function inside a .lib in a gateway function ? I think it's
>> possible, as other part of Scilab's source code contains code writed
>> in fortran...But without the builder script.
>>
>>
>>
>>
>
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LU.zip
Type: application/x-zip-compressed
Size: 120195 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/dev/attachments/20090504/4181f800/attachment.bin>


More information about the dev mailing list