[PD-dev] calling external code(.dll) from pd-external(win32xp)

Martin Peach martin.peach at sympatico.ca
Wed Mar 12 20:00:21 CET 2008


best boy

>maybe this is a misunderstanding. i try to explain.
>i want to write a pd external (which will be a dll on win).
>this pd external should contain code to call functions from another dll 
>which is not pd-related
>

I think you would still use the same two functions: LoadLibrary to load the 
dll and GetProcAddress to find the address of the function you want to call. 
It won't make any difference if you call the dll from another dll or an exe.
LoadLibrary() and GetProcAddress() are part of the Windows API and not 
related to pd.

Martin

> >
> > This little bit from s_loader.c shows how pd loads externals, which are 
>dlls
> > on Windows:
> >
> > #ifdef MSW
> >     {
> >         HINSTANCE ntdll = LoadLibrary(filename);
> >         if (!ntdll)
> >         {
> >             post("%s: couldn't load external scheduler lib ", filename);
> >             return (0);
> >         }
> >         externalmainfunc =
> >             (t_externalschedlibmain)GetProcAddress(ntdll, "main");
> >     }
> >
> > Martin






More information about the Pd-dev mailing list