make_dll and call_external.... [message #42786] |
Thu, 24 February 2005 04:49  |
fabrice.monti
Messages: 4 Registered: February 2005
|
Junior Member |
|
|
in a recent post, i tried to remote a CCD by "mil.h" library and a
call_external procedure.... Rick and Mark tried to help me, but i
haven't a good background to do this... Today I read "the external
development guide" and a tutorial about this subject... and i always
have a probleme....
step by step, i wrote a C code. and i would like to call with IDL.
this code is binarize a image... it very simple for the moment, i will
see the next later...
my C code is : (name is binarize_call.c)
# include <stdio.h>
# include "export.h"
uchar binarize (int argc, char *argv)
{
UCHAR *data,*data_tmp,t,new_t;
IDL_LONG64 s0,s1;
IDL_LONG n,i,n0,n1;
data=(uchar *) argv[0];
n=*(IDL_long *) argv[1];
s0=0;data_tmp=data;
for (i=n;i--;) s0+=(*data_tmp++);
new_t=s0/n;
do {
t=new_t;
n0=n1=0;s0=s1=0;
for(i=n,data_tmp=data;i--;data_tmp++)
if ((*data_tmp) < t) {n0++;s0+=(*data_tmp);}
else {n1++;s1+=(*data_tmp);}
new_t=(n1*s0+n0*s1)/(2*n0*n1);
} while (t != new_t);
for(data_tmp=data,i=n;i--;data_tmp++)
*data_tmp = *data_tmp > t;
return t;
}
my IDL code is:
pro test_call
make_dll, "binarize_call", "binarize", compile_directory= ".",
dll_path=dll
image= read_image(filepath("mr_abdomen.dcm",
subdirectory=["examples","data"]))
window, 0, xs=512, ys=256
tv, image,0
res= call_external (dll, "binarize", image, n_elements(image),
/b_value,/unload, /cdecl)
help, result
tvscl, image,1
end
and the output is:
'cl' n'est pas reconnu en tant que commande interne
ou externe, un programme ex‚cutable ou un fichier de commandes.
cl -D_DLL -DWIN32 -D_MT /nologo /I"C:\Program
Files\RSI\IDL60\external\include" /c "C:\Program
Files\RSI\IDL60\binarize_call.c"
/Fo"binarize_call_1260_ANALIMAGES.obj"
Impossible de trouver C:\Program
Files\RSI\IDL60\binarize_call_1260_ANALIMAGES.exp
Impossible de trouver C:\Program
Files\RSI\IDL60\binarize_call_1260_ANALIMAGES.lib
Impossible de trouver C:\Program
Files\RSI\IDL60\binarize_call_1260_ANALIMAGES.obj
% CALL_EXTERNAL: Error loading sharable executable.
Symbol: binarize, File = .\binarize_call.dll
ERROR_MOD_NOT_FOUND
% Execution halted at: $MAIN$ 12 C:\Program
Files\RSI\fabrice\test_call.pro
My complier is a freeware "microsoft visual C++ toolkit".(MVC++)
in the output, IDL search the 'CL'. This file is include in the MVC++
folder, but i don't where is the setting path to permit IDL to found
this file. I tried to save the path in a general setting but it
doesn't work....
the !Make_dll setting is:
compile_directory : C:\Documents and
Settings\montif\.idl\idl_6_0_Win32_x86_m32_f64\compile_dir
complie_name : Microsoft Visual C++ 7.0
CC : cl %X -D_DLL -DWIN32 -D_MT /nologo /I"C:\Program
Files\RSI\IDL60\external\include" /c %C /Fo%O
LD :link /out:%L /nologo /nodefaultlib /dll %O /def:%E "C:\Program
Files\RSI\IDL60\bin\bin.x86\idl32.lib" msvcrt.lib kernel32.lib %X
I hope that somebody will be able to help me..
thanks
|
|
|
Re: make_dll and call_external.... [message #42898 is a reply to message #42786] |
Wed, 02 March 2005 10:51  |
Marc Reinig
Messages: 30 Registered: June 2004
|
Member |
|
|
I prefer making a DLM. Then life seems simpler, at least to me. However:
> 'cl' n'est pas reconnu en tant que commande interne
> ou externe, un programme ex‚cutable ou un fichier de commandes.
' cl' is not recognized as an internal or external command, a program,
executable or a command file.
So your first problem is that cl didn't get executed. You probably need to
specify the entire path or have it on your path.
Having no file generated by "make_dll" led to your other problems
Marco
________________________
Marc Reinig
UCO/Lick Observatory
Laboratory for Adaptive Optics
"Fabrice Monti" <fabrice.monti@espci.fr> wrote in message
news:ba06b53f.0502240449.2b8cd0f9@posting.google.com...
> in a recent post, i tried to remote a CCD by "mil.h" library and a
> call_external procedure.... Rick and Mark tried to help me, but i
> haven't a good background to do this... Today I read "the external
> development guide" and a tutorial about this subject... and i always
> have a probleme....
> step by step, i wrote a C code. and i would like to call with IDL.
> this code is binarize a image... it very simple for the moment, i will
> see the next later...
>
> my C code is : (name is binarize_call.c)
>
> # include <stdio.h>
> # include "export.h"
>
> uchar binarize (int argc, char *argv)
> {
> UCHAR *data,*data_tmp,t,new_t;
> IDL_LONG64 s0,s1;
> IDL_LONG n,i,n0,n1;
>
> data=(uchar *) argv[0];
> n=*(IDL_long *) argv[1];
>
> s0=0;data_tmp=data;
> for (i=n;i--;) s0+=(*data_tmp++);
> new_t=s0/n;
> do {
> t=new_t;
> n0=n1=0;s0=s1=0;
> for(i=n,data_tmp=data;i--;data_tmp++)
> if ((*data_tmp) < t) {n0++;s0+=(*data_tmp);}
> else {n1++;s1+=(*data_tmp);}
> new_t=(n1*s0+n0*s1)/(2*n0*n1);
> } while (t != new_t);
>
> for(data_tmp=data,i=n;i--;data_tmp++)
> *data_tmp = *data_tmp > t;
> return t;
> }
>
> my IDL code is:
>
> pro test_call
> make_dll, "binarize_call", "binarize", compile_directory= ".",
> dll_path=dll
> image= read_image(filepath("mr_abdomen.dcm",
> subdirectory=["examples","data"]))
> window, 0, xs=512, ys=256
> tv, image,0
> res= call_external (dll, "binarize", image, n_elements(image),
> /b_value,/unload, /cdecl)
> help, result
> tvscl, image,1
> end
>
> and the output is:
>
> 'cl' n'est pas reconnu en tant que commande interne
> ou externe, un programme ex‚cutable ou un fichier de commandes.
> cl -D_DLL -DWIN32 -D_MT /nologo /I"C:\Program
> Files\RSI\IDL60\external\include" /c "C:\Program
> Files\RSI\IDL60\binarize_call.c"
> /Fo"binarize_call_1260_ANALIMAGES.obj"
> Impossible de trouver C:\Program
> Files\RSI\IDL60\binarize_call_1260_ANALIMAGES.exp
> Impossible de trouver C:\Program
> Files\RSI\IDL60\binarize_call_1260_ANALIMAGES.lib
> Impossible de trouver C:\Program
> Files\RSI\IDL60\binarize_call_1260_ANALIMAGES.obj
> % CALL_EXTERNAL: Error loading sharable executable.
> Symbol: binarize, File = .\binarize_call.dll
> ERROR_MOD_NOT_FOUND
> % Execution halted at: $MAIN$ 12 C:\Program
> Files\RSI\fabrice\test_call.pro
>
> My complier is a freeware "microsoft visual C++ toolkit".(MVC++)
>
> in the output, IDL search the 'CL'. This file is include in the MVC++
> folder, but i don't where is the setting path to permit IDL to found
> this file. I tried to save the path in a general setting but it
> doesn't work....
>
> the !Make_dll setting is:
> compile_directory : C:\Documents and
> Settings\montif\.idl\idl_6_0_Win32_x86_m32_f64\compile_dir
> complie_name : Microsoft Visual C++ 7.0
> CC : cl %X -D_DLL -DWIN32 -D_MT /nologo /I"C:\Program
> Files\RSI\IDL60\external\include" /c %C /Fo%O
> LD :link /out:%L /nologo /nodefaultlib /dll %O /def:%E "C:\Program
> Files\RSI\IDL60\bin\bin.x86\idl32.lib" msvcrt.lib kernel32.lib %X
>
> I hope that somebody will be able to help me..
> thanks
|
|
|