www.digitalmars.com         C & C++   DMDScript  

D - imagemagick wrapper?

reply "Mårten Ask" <majbritt37 hotmail.com> writes:
Hi,

I want to use som functions from the imagemagick C api. How do I do that?
How do I call the functions and objects and how do I link with the dll's?
Aug 12 2003
parent reply "Mike Wynn" <mike.wynn l8night.co.uk> writes:
here's a templated class lib I wrote to help with dll loading ('cos I like
the delphi extern "foo.dll"; )
and an example (loads winmm.dll to all access to multimedia timers)
due to D's templateing its a little verbose, but works ...

first make instances of the types of functions you want to import
e.g. `extern (windows) DWORD func();`
instance DynFunc( Windows, DWORD ) noParamReturnsDword;

the declare a func pointer to it (using the template instance)
`<instance>.fp` e.g. ....
noParamReturnsDword.fp myFunc;

// now write a static initialiser to your module to load the dll and get the
function.
// there are two ways to do this both have the same result but its personal
preference which you use
static this()
{
// fp = <template>.require( <dll name>, <func_name> ); // I perfer this
myFunc = I_I_Ldr.require( "foo.dll", "someFuncname" );
// <template>.use( fp, <dll name>, <func_name> );
noParamReturnsDword.use( myFunc,   "foo.dll", "someFuncname" );
}

for C fucntions use
instance DynFunc( C, <return_type>, <param1>, <param2> .... ) somename;
if the return type is void due to D templates you can't use
instance DynFunc( C, void, int );
instead you have to use DynProc( C, int );
or DyncProc( C ) => extern(C) void func( void );

to do it manually here the code that loads up and gets a directx d3d
interface from the function
`Direct3DCreate8` in `d3d8.dll`

extern(Windows) alias IDirect3D8 function( UINT ) start_up_fp;

IDirect3D8 loadD3DLibs() {
 HMODULE sysModule;
 sysModule = LoadLibraryA( "d3d8.dll" );   // load a dll
 FARPROC fp = GetProcAddress( sysModule, cast(char*)"Direct3DCreate8" ); //
get a function pointer
 assert(fp);
 start_up_fp dxfp = cast(start_up_fp)fp;
 return dxfp(D3D_SDK_VERSION);
}

failing all that .... use implib to convert the dll to a .lib and just write
the functions as
extern( C ) .....
or extern(Windows) .....
the linker will the link correctly against <foo>.dll if you link against the
created lib file.


"Mårten Ask" <majbritt37 hotmail.com> wrote in message
news:bhb9cs$1eq3$1 digitaldaemon.com...
 Hi,

 I want to use som functions from the imagemagick C api. How do I do that?
 How do I call the functions and objects and how do I link with the dll's?
begin 666 dynloader.d M:6YK86=E+D0 1#L- M92!(34]$54Q%('-Y<TUO9'5L93L-" EP<F]T96-T960 =&AI<R 8VAA<EM= M.PT*"0EI9B H("%S>7--;V1U;&4 *2!T:')O=R!N97< 17AC97!T:6]N*" B M=6YA8FQE('1O(&QO860 <VAA<F5D(&QI8G)A<GD (B!^('!A=& *3L-" E] M9G5N8TYA;64 *0T*"7L-" D)1D%24%)/0R!F<" ]($=E=%!R;V-!9&1R97-S M*"!S>7--;V1U;&4L(&-A<W0H8VAA<BHI9G5N8TYA;64 *3L-" D):68 *" A M9G *2!T:')O=R!N97< 17AC97!T:6]N*" B=6YA8FQE('1O(&=E="!F=6YC M<')I=F%T92!S=&%T:6, 4VAA<F5D3&EB<F%R>5MC:&%R6UU=(&QO861E9#L- M" EP=6)L:6, <W1A=&EC(%-H87)E9$QI8G)A<GD ;&]A9$QI8G)A<GDH(&-H M*'-L(#T ;&]A9&5D6W!A=&A=*2 ]/3T ;G5L;" I(')E='5R;B!L;V%D961; M<&%T:%T /2!N97< 4VAA<F5D3&EB<F%R>2 <&%T:" I.PT*"0ER971U<FX M*"!C:&%R6UT ;&EB+"!C:&%R6UT ;F%M92 I('L-" D)<F5T=7)N(&-A<W0H M5"DH*%-H87)E9$QI8G)A<GDN;&]A9$QI8G)A<GDH(&QI8B I*2YG971&=6YC M(&YE=R!%>&-E<'1I;VXH(")3:&%R960 1G5N8W1I;VX ;F]T(&QO861E9"( M;&%T92!$>6Y0<F]C*"!,:6YK86=E(%0 .B!,:6YK86=E+E=I;F1O=W, *2![ M(&YE=R!%>&-E<'1I;VXH(")3:&%R960 1G5N8W1I;VX ;F]T(&QO861E9"( M*3L ?2 -" D)='EP961E9B!V;VED(" J9G I*"D /2 F97)F.PT*"7T-" EI M;G-T86YC92!$>6XH(&9P("D 9'EN1G5N8SL-" EA;&EA<R!D>6Y&=6YC+G5S M"G1E;7!L871E($1Y;E!R;V,H($QI;FMA9V4 5" Z($QI;FMA9V4N0R I('L- M"71Y<&5D968 =F]I9" H*F9P*2 I(#T M9"!E<F8H(% <" I('L =&AR;W< ;F5W($5X8V5P=&EO;B (E-H87)E9"!& M=6YC=&EO;B!N;W0 ;&]A9&5D(B I.R!]( T*"71Y<&5D968 =F]I9" H*F9P M*2 4" I(#T )F5R9CL-" EI;G-T86YC92!$>6XH(&9P("D 9'EN1G5N8SL- M:&%R960 1G5N8W1I;VX ;F]T(&QO861E9"( *3L ?2 -" D)='EP961E9B!V M;VED(" J9G I*"!0("D /2 F97)F.PT*"7T-" EI;G-T86YC92!$>6XH(&9P M('L-" D)=F]I9"!E<F8H(% <" I('L =&AR;W< ;F5W($5X8V5P=&EO;B M(E-H87)E9"!&=6YC=&EO;B!N;W0 ;&]A9&5D(B I.R!]( T*"0ET>7!E9&5F M9G *2!D>6Y&=6YC.PT*"6%L:6%S(&1Y;D9U;F,N=7-E('5S93L-" EA;&EA M<R!D>6Y&=6YC+G)E<75I<F4 <F5Q=6ER93L-"GT-" T*=&5M<&QA=&4 1'EN M4')O8R 3&EN:V%G92!4(#H M9"!E<F8H(% P(' P+"!0,2!P,2 I('L =&AR;W< ;F5W($5X8V5P=&EO;B M(E-H87)E9"!&=6YC=&EO;B!N;W0 ;&]A9&5D(B I.R!R971U<FX 4BYI;FET M8RYU<V4 =7-E.PT*"6%L:6%S(&1Y;D9U;F,N<F5Q=6ER92!R97%U:7)E.PT* M;F1O=W,L(% P+"!0,2 I('L-" EE>'1E<FX *%=I;F1O=W,I('L-" D)=F]I M9"!E<F8H(% P(' P+"!0,2!P,2 I('L =&AR;W< ;F5W($5X8V5P=&EO;B M(E-H87)E9"!&=6YC=&EO;B!N;W0 ;&]A9&5D(B I.R!R971U<FX 4BYI;FET M.R!]( T*"0ET>7!E9&5F('9O:60 *"IF<"DH(% P+"!0,2 I(#T )F5R9CL- M1G5N8RYU<V4 =7-E.PT*"6%L:6%S(&1Y;D9U;F,N<F5Q=6ER92!R97%U:7)E M;G-T86YC92!$>6XH(&9P("D 9'EN1G5N8SL-" EA;&EA<R!D>6Y&=6YC+G5S M" T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G92!4("D >PT*"6EN<W1A;F-E M:6%S(')E86Q496UP;&%T92YU<V4 =7-E.PT*"6%L:6%S(')E86Q496UP;&%T M(')E86Q496UP;&%T93L-" EA;&EA<R!R96%L5&5M<&QA=&4N97)F(&5R9CL- M=6ER93L-"GT-" T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G92!4(#H 3&EN M:V%G92Y$+"!2("D >PT*"5( 97)F*"D >R!T:')O=R!N97< 17AC97!T:6]N M*" B4VAA<F5D($9U;F-T:6]N(&YO="!L;V%D960B("D[(')E='5R;B!2+FEN M($1Y;B 9G *2!D>6Y&=6YC.PT*"6%L:6%S(&1Y;D9U;F,N=7-E('5S93L- M" EA;&EA<R!D>6Y&=6YC+G)E<75I<F4 <F5Q=6ER93L-"GT-" T*=&5M<&QA M=&4 1'EN1G5N8R 3&EN:V%G92!4(#H M*" B4VAA<F5D($9U;F-T:6]N(&YO="!L;V%D960B("D[(')E='5R;B!2+FEN M96UP;&%T92!$>6Y&=6YC*"!,:6YK86=E(%0 .B!,:6YK86=E+E=I;F1O=W,L M<F]W(&YE=R!%>&-E<'1I;VXH(")3:&%R960 1G5N8W1I;VX ;F]T(&QO861E M9"( *3L <F5T=7)N(%(N:6YI=#L ?2 -" D)='EP961E9B!2(" J9G I*"D M/2 F97)F.PT*"7T-" EI;G-T86YC92!$>6XH(&9P("D 9'EN1G5N8SL-" EA M8R 5"P 4" I(')E86Q496UP;&%T93L-" EA;&EA<R!R96%L5&5M<&QA=&4N M<75I<F4 <F5Q=6ER93L-"GT-" T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G M92!4(#H M>6Y0<F]C*"!4+"!0("D <F5A;%1E;7!L871E.PT*"6%L:6%S(')E86Q496UP M;&%T92YE<F8 97)F.PT*"6%L:6%S(')E86Q496UP;&%T92YF<"!F<#L-" EA M;&EA<R!R96%L5&5M<&QA=&4N=7-E('5S93L-" EA;&EA<R!R96%L5&5M<&QA M:6YK86=E(%0 .B!,:6YK86=E+E=I;F1O=W,L(%( .B!V;VED+"!0("D >PT* M+F9P(&9P.PT*"6%L:6%S(')E86Q496UP;&%T92YU<V4 =7-E.PT*"6%L:6%S M($1Y;D9U;F,H($QI;FMA9V4 5" Z($QI;FMA9V4N1"P 4BP 4" I('L-" E2 M(&5R9B 4"!P("D >R!T:')O=R!N97< 17AC97!T:6]N*" B4VAA<F5D($9U M961E9B!2(" J9G I*% I(#T )F5R9CL-" EI;G-T86YC92!$>6XH(&9P("D M(" 5VEN9&]W<R I('L-" D)4B!E<F8H(% <" I('L =&AR;W< ;F5W($5X M8V5P=&EO;B (E-H87)E9"!&=6YC=&EO;B!N;W0 ;&]A9&5D(B I.R!R971U M<FX 4BYI;FET.R!]( T*"0ET>7!E9&5F(%( *"IF<"DH4"D /2 F97)F.PT* M"7T-" EI;G-T86YC92!$>6XH(&9P("D 9'EN1G5N8SL-" EA;&EA<R!D>6Y& M:')O=R!N97< 17AC97!T:6]N*" B4VAA<F5D($9U;F-T:6]N(&YO="!L;V%D M"6%L:6%S(&1Y;D9U;F,N=7-E('5S93L-" EA;&EA<R!D>6Y&=6YC+G)E<75I M<F4 <F5Q=6ER93L-"GT-"G1E;7!L871E($1Y;D9U;F,H($QI;FMA9V4 5" Z M($QI;FMA9V4N1"P 4B Z('9O:60L(% P+"!0,2 I('L-" EI;G-T86YC92!$ M.PT*"6%L:6%S(')E86Q496UP;&%T92YU<V4 =7-E.PT*"6%L:6%S(')E86Q4 M*"!,:6YK86=E(%0 .B!,:6YK86=E+E=I;F1O=W,L(%( .B!V;VED+"!0,"P M;7!L871E.PT*"6%L:6%S(')E86Q496UP;&%T92YE<F8 97)F.PT*"6%L:6%S M(')E86Q496UP;&%T92YF<"!F<#L-" EA;&EA<R!R96%L5&5M<&QA=&4N=7-E M('5S93L-" EA;&EA<R!R96%L5&5M<&QA=&4N<F5Q=6ER92!R97%U:7)E.PT* M?0T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G92!4(#H M(#H M+"!0,2 I(')E86Q496UP;&%T93L-" EA;&EA<R!R96%L5&5M<&QA=&4N97)F M<F4 <F5Q=6ER93L-"GT-" T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G92!4 M(#H M,2!P,2 I('L =&AR;W< ;F5W($5X8V5P=&EO;B (E-H87)E9"!&=6YC=&EO M;B!N;W0 ;&]A9&5D(B I.R!R971U<FX 4BYI;FET.R!]( T*"71Y<&5D968 M:6YK86=E(%0 .B!,:6YK86=E+E=I;F1O=W,L(%(L(% P+"!0,2 I('L-" EE M('1H<F]W(&YE=R!%>&-E<'1I;VXH(")3:&%R960 1G5N8W1I;VX ;F]T(&QO M861E9"( *3L <F5T=7)N(%(N:6YI=#L ?2 -" D)='EP961E9B!2(" J(&9P M*2A0,"Q0,2D /2 F97)F.PT*"7T-" EI;G-T86YC92!$>6XH(&9P("D 9'EN M97!T:6]N*" B4VAA<F5D($9U;F-T:6]N(&YO="!L;V%D960B("D[(')E='5R M9'EN1G5N8RYU<V4 =7-E.PT*"6%L:6%S(&1Y;D9U;F,N<F5Q=6ER92!R97%U M:7)E.PT*?0T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G92!4(#H 3&EN:V%G M92Y$+"!2(#H M86Q496UP;&%T92YE<F8 97)F.PT*"6%L:6%S(')E86Q496UP;&%T92YF<"!F M<#L-" EA;&EA<R!R96%L5&5M<&QA=&4N=7-E('5S93L-" EA;&EA<R!R96%L M5&5M<&QA=&4N<F5Q=6ER92!R97%U:7)E.PT*?0T*=&5M<&QA=&4 1'EN1G5N M8R 3&EN:V%G92!4(#H 3&EN:V%G92Y7:6YD;W=S+"!2(#H M("D <F5A;%1E;7!L871E.PT*"6%L:6%S(')E86Q496UP;&%T92YE<F8 97)F M.PT*"6%L:6%S(')E86Q496UP;&%T92YF<"!F<#L-" EA;&EA<R!R96%L5&5M M<&QA=&4N=7-E('5S93L-" EA;&EA<R!R96%L5&5M<&QA=&4N<F5Q=6ER92!R M97%U:7)E.PT*?0T*=&5M<&QA=&4 1'EN1G5N8R 3&EN:V%G92!4(#H 3&EN M(')E86Q496UP;&%T92YE<F8 97)F.PT*"6%L:6%S(')E86Q496UP;&%T92YF M<"!F<#L-" EA;&EA<R!R96%L5&5M<&QA=&4N=7-E('5S93L-" EA;&EA<R!R M96%L5&5M<&QA=&4N<F5Q=6ER92!R97%U:7)E.PT*?0T*+RH-"G1E;7!L871E M;&%T93L-" EA;&EA<R!R96%L5&5M<&QA=&4N97)F(&5R9CL-" EA;&EA<R!R M;F]T(&QO861E9"( *3L <F5T=7)N(%(N:6YI=#L ?2 -" ET>7!E9&5F(%( M*2!D>6Y&=6YC.PT*"6%L:6%S(&1Y;D9U;F,N=7-E('5S93L-" EA;&EA<R!D M>6Y&=6YC+G)E<75I<F4 <F5Q=6ER93L-"GT-"G1E;7!L871E($1Y;D9U;F,H M(' Q+"!0,B!P,B I('L =&AR;W< ;F5W($5X8V5P=&EO;B (E-H87)E9"!& M=6YC=&EO;B!N;W0 ;&]A9&5D(B I.R!R971U<FX 4BYI;FET.R!]( T*"0ET M86YC92!$>6XH(&9P("D 9'EN1G5N8SL-" EA;&EA<R!D>6Y&=6YC+G5S92!U M;&%T92!$>6Y&=6YC*"!,:6YK86=E(%0 .B!,:6YK86=E+D,L(%(L(% P+"!0 M1G5N8W1I;VX ;F]T(&QO861E9"( *3L <F5T=7)N(%(N:6YI=#L ?2 -" D) ` end begin 666 winmm.d M(%=I;F1O=W,L($U-4D5354Q4+"!U:6YT("D 25])7TQD<CL-"FEN<W1A;F-E M($1Y;D9U;F,H(%=I;F1O=W,L($173U)$("D 25]67TQD<CL-" T*25])7TQD M;6TN9&QL(BP (G1I;65"96=I;E!E<FEO9"( *3L-" E)7TE?3&1R+G5S92 M=&EM945N9%!E<FEO9"P (" B=VEN;6TN9&QL(BP (G1I;65%;F1097)I;V0B 9;"(L(")T:6UE1V5T5&EM92( *3L-"GT-" `` ` end
Aug 12 2003
parent reply "Mårten Ask" <majbritt37 hotmail.com> writes:
Thanks!

I haven't had time to try it out yet..

There's still one thing that puzzles me though. Structs. how do I declare
that I want a struct from the dll? From the imagemagick api:

typedef struct _MagickWand
  MagickWand;
  ...
extern MagickExport MagickWand
  *MagickCloneWand(const MagickWand *),
  *MagickCoalesceImages(MagickWand *),
  *NewMagickWand(void);
  ...

Obviously I need to declare those functions as 'extern (C) MagickWand
NewMagickWand()' but then the compiler complains about not knowing what a
MagickWand is. Do I write 'extern (C) struct MagickWand'? Or 'extern (C)
typedef MagickWand'?



"Mike Wynn" <mike.wynn l8night.co.uk> skrev i meddelandet
news:bhbaa0$1ftb$1 digitaldaemon.com...
 here's a templated class lib I wrote to help with dll loading ('cos I like
 the delphi extern "foo.dll"; )
 and an example (loads winmm.dll to all access to multimedia timers)
 due to D's templateing its a little verbose, but works ...

 first make instances of the types of functions you want to import
 e.g. `extern (windows) DWORD func();`
 instance DynFunc( Windows, DWORD ) noParamReturnsDword;

 the declare a func pointer to it (using the template instance)
 `<instance>.fp` e.g. ....
 noParamReturnsDword.fp myFunc;

 // now write a static initialiser to your module to load the dll and get
the
 function.
 // there are two ways to do this both have the same result but its
personal
 preference which you use
 static this()
 {
 // fp = <template>.require( <dll name>, <func_name> ); // I perfer this
 myFunc = I_I_Ldr.require( "foo.dll", "someFuncname" );
 // <template>.use( fp, <dll name>, <func_name> );
 noParamReturnsDword.use( myFunc,   "foo.dll", "someFuncname" );
 }

 for C fucntions use
 instance DynFunc( C, <return_type>, <param1>, <param2> .... ) somename;
 if the return type is void due to D templates you can't use
 instance DynFunc( C, void, int );
 instead you have to use DynProc( C, int );
 or DyncProc( C ) => extern(C) void func( void );

 to do it manually here the code that loads up and gets a directx d3d
 interface from the function
 `Direct3DCreate8` in `d3d8.dll`

 extern(Windows) alias IDirect3D8 function( UINT ) start_up_fp;

 IDirect3D8 loadD3DLibs() {
  HMODULE sysModule;
  sysModule = LoadLibraryA( "d3d8.dll" );   // load a dll
  FARPROC fp = GetProcAddress( sysModule, cast(char*)"Direct3DCreate8" );
//
 get a function pointer
  assert(fp);
  start_up_fp dxfp = cast(start_up_fp)fp;
  return dxfp(D3D_SDK_VERSION);
 }

 failing all that .... use implib to convert the dll to a .lib and just
write
 the functions as
 extern( C ) .....
 or extern(Windows) .....
 the linker will the link correctly against <foo>.dll if you link against
the
 created lib file.


 "Mårten Ask" <majbritt37 hotmail.com> wrote in message
 news:bhb9cs$1eq3$1 digitaldaemon.com...
 Hi,

 I want to use som functions from the imagemagick C api. How do I do
that?
 How do I call the functions and objects and how do I link with the
dll's?

Aug 15 2003
parent "Mike Wynn" <mike.wynn l8night.co.uk> writes:
"Mårten Ask" <majbritt37 hotmail.com> wrote in message
news:bhjaf3$348$1 digitaldaemon.com...
 Thanks!

 I haven't had time to try it out yet..

 There's still one thing that puzzles me though. Structs. how do I declare
 that I want a struct from the dll? From the imagemagick api:
the compiler only needs to know about the struct layout, this is usually in the c header some times you will find typedef struct _foo { } * ApiToken; either way the dll does not "export" the struct layout. if the dll contains a struct then I assume its struct foo { int a; } extern (C) foo in_dll; I've only every used "getProcAddress" or implicit linking I'm not sure what VC++/Windows does with dll's contain data too, guess I better read some docs might be useful!! read on about how to declare the struct;
 typedef struct _MagickWand
   MagickWand;
   ...
 extern MagickExport MagickWand
   *MagickCloneWand(const MagickWand *),
   *MagickCoalesceImages(MagickWand *),
   *NewMagickWand(void);
you need to know what the _MagicWand struct looks like .. also note the use of align. struct Foo { align(1): byte a, b; int missaligned; }; struct Foo2 { align(4): byte a, b; int aligned; align(1): byte c; int offby1; }; (the default for D and C is to align items at their size (works on CISC and RISC then)) only the functions need to be extern(C) etc extern(C) : Foo * getFooFromFoo2( Foo2* ); Foo* getContext(); etc... asfaik (Walter correct me here if I'm wrong) the only time making a struct, alias or typedef as extern(CONV) is if it contains a pointer to func that you want to have that calling convention. although is does help document the code to have extern(C) struct MyStruct { align(4): int a, b, c, d; } (implies that its for use with extern(C) funcs).
   ...

 Obviously I need to declare those functions as 'extern (C) MagickWand
 NewMagickWand()' but then the compiler complains about not knowing what a
 MagickWand is. Do I write 'extern (C) struct MagickWand'? Or 'extern (C)
 typedef MagickWand'?



 "Mike Wynn" <mike.wynn l8night.co.uk> skrev i meddelandet
 news:bhbaa0$1ftb$1 digitaldaemon.com...
 here's a templated class lib I wrote to help with dll loading ('cos I
like
 the delphi extern "foo.dll"; )
 and an example (loads winmm.dll to all access to multimedia timers)
 due to D's templateing its a little verbose, but works ...

 first make instances of the types of functions you want to import
 e.g. `extern (windows) DWORD func();`
 instance DynFunc( Windows, DWORD ) noParamReturnsDword;

 the declare a func pointer to it (using the template instance)
 `<instance>.fp` e.g. ....
 noParamReturnsDword.fp myFunc;

 // now write a static initialiser to your module to load the dll and get
the
 function.
 // there are two ways to do this both have the same result but its
personal
 preference which you use
 static this()
 {
 // fp = <template>.require( <dll name>, <func_name> ); // I perfer this
 myFunc = I_I_Ldr.require( "foo.dll", "someFuncname" );
 // <template>.use( fp, <dll name>, <func_name> );
 noParamReturnsDword.use( myFunc,   "foo.dll", "someFuncname" );
 }

 for C fucntions use
 instance DynFunc( C, <return_type>, <param1>, <param2> .... ) somename;
 if the return type is void due to D templates you can't use
 instance DynFunc( C, void, int );
 instead you have to use DynProc( C, int );
 or DyncProc( C ) => extern(C) void func( void );

 to do it manually here the code that loads up and gets a directx d3d
 interface from the function
 `Direct3DCreate8` in `d3d8.dll`

 extern(Windows) alias IDirect3D8 function( UINT ) start_up_fp;

 IDirect3D8 loadD3DLibs() {
  HMODULE sysModule;
  sysModule = LoadLibraryA( "d3d8.dll" );   // load a dll
  FARPROC fp = GetProcAddress( sysModule, cast(char*)"Direct3DCreate8" );
//
 get a function pointer
  assert(fp);
  start_up_fp dxfp = cast(start_up_fp)fp;
  return dxfp(D3D_SDK_VERSION);
 }

 failing all that .... use implib to convert the dll to a .lib and just
write
 the functions as
 extern( C ) .....
 or extern(Windows) .....
 the linker will the link correctly against <foo>.dll if you link against
the
 created lib file.


 "Mårten Ask" <majbritt37 hotmail.com> wrote in message
 news:bhb9cs$1eq3$1 digitaldaemon.com...
 Hi,

 I want to use som functions from the imagemagick C api. How do I do
that?
 How do I call the functions and objects and how do I link with the
dll's?

Aug 15 2003