hi, are there any examples (source.c) for calling a dll from within a pd external?
thanks olli
_________________________________________________________________ Testen Sie Live.com - die schnelle, personalisierte Homepage, über die Sie auf alle für Sie relevanten Inhalte zentral zugreifen können. http://www.live.com/getstarted
best boy wrote:
hi, are there any examples (source.c) for calling a dll from within a pd external?
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
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
From: martin.peach@sympatico.ca To: ladataxi@hotmail.de; pd-dev@iem.at Subject: RE: [PD-dev] calling external code(.dll) from pd-external(win32xp) Date: Wed, 12 Mar 2008 18:16:27 +0000
best boy wrote:
hi, are there any examples (source.c) for calling a dll from within a pd external?
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
_________________________________________________________________ Testen Sie Live.com - die schnelle, personalisierte Homepage, über die Sie auf alle für Sie relevanten Inhalte zentral zugreifen können. http://www.live.com/getstarted
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
Martin Peach wrote:
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.
i think the question is about simple dynamic linking (without manually opening the dll and calling an entry-point function therein)
much like Gem linking against openGL.
olli: all externals on w32 do link dynamically against several libraries. one of them being pd.dll, the other ones including libc. i think you just need the corresponding "header" .lib and that to the libraries you link against. so take any external you like as an example :-)
fgamdsr IOhannes
ok, thank you very much for your help LoadLibrary() and GetProcAddress do the job now. and it seems to work :) bye bb
From: martin.peach@sympatico.ca To: ladataxi@hotmail.de; pd-dev@iem.at Subject: RE: [PD-dev] calling external code(.dll) from pd-external(win32xp) Date: Wed, 12 Mar 2008 19:00:21 +0000
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
_________________________________________________________________ Testen Sie Live.com - das Zentrum Ihrer Online-Welt, das Sie mit aktuellen Nachrichten, Sport- und Wetterinfos und vielem mehr versorgt. http://www.live.com/getstarted
If you just want your external to link against another dll, that happens automatically with the MinGW build system. There are lots of externals that do this that are included in Pd-extended (as well as the DLLs).
.hc
On Mar 12, 2008, at 4:05 PM, best boy wrote:
ok, thank you very much for your help LoadLibrary() and GetProcAddress do the job now. and it seems to work :) bye bb
From: martin.peach@sympatico.ca To: ladataxi@hotmail.de; pd-dev@iem.at Subject: RE: [PD-dev] calling external code(.dll) from pd-external
(win32xp)
Date: Wed, 12 Mar 2008 19:00:21 +0000
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
Kostenlos bloggen + eigene Homepage + Fotospeicher = MSN Spaces Kostenlos! _______________________________________________ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
------------------------------------------------------------------------ ----
"It is convenient to imagine a power beyond us because that means we don't have to examine our own lives.", from "The Idols of Environmentalism", by Curtis White