From: "rozni yusof" on 8 Dec 2006 06:48 I still don't have the hang of this thing... the compiler says "DT_Init cannot be used as a function". It loads and unloads the DLL ok. #include "oldaapi.h" void wxloadDlg::WxButton1Click(wxCommandEvent& event) { // insert your code here wxDynamicLibrary dll; if(dll.Load("oldaapi32.dll")) wxLogMessage("successful load"); ECODE *DT_Init, errorcode; *DT_Init=(ECODE)dll.GetSymbol(wxT("olDaInitialize")); LPSTR lpszName; LPHDEV lphDev; *DT_Init(lpszName, lphDev); //this line is wrong? dll.Unload(); if(!dll.IsLoaded()) wxLogMessage ("successful unload"); } On 6/2/06, Iulian-Nicu Serbanoiu <undergraver(a)gmail.com> wrote: > > If I think a little I could a general case ( cross platform ) and > of course the wxDynamicLibrary class can be used cross > platform ( at least it should ) > > // this code is not tested but I'm guessing it is ok in general > > #ifdef _WIN32 > > // windows specific includes ... > > #define DLL_EXPORT __declspec(dllexport) > > #else > > // unix specific includes .... > > #define DLL_EXPORT > > #endif > ....... > > #ifdef __cplusplus > extern "C" { > #endif > > > DLL_EXPORT int PROCEDURE_00(int param1,int param2); > > #ifdef __cplusplus > } > #endif > > I think this would be more convenient > > Regards, > > Iulian > > > > On 6/2/06, Jose Marin <jose_marin2(a)yahoo.com.br > wrote: > > The wxWidgets part can be used in any platform (Mc, > > Linux), only change the way the dll are created? > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: Jonas Rydberg on 8 Dec 2006 07:16 Hi rozni yusof wrote / skrev: > I still don't have the hang of this thing... the compiler says > "DT_Init cannot be used as a function". It loads and unloads the DLL > ok. <snip> > ECODE *DT_Init, errorcode; > *DT_Init=(ECODE)dll.GetSymbol(wxT("olDaInitialize")); You must declare the symbol as a function pointer if you want to call it later. Look at the console sample for a simple example on how to use wxDynamicLibrary. Regards /Jonas --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: "Iulian-Nicu Serbanoiu" on 8 Dec 2006 10:12 I gave you an example in this thread earlier this year ( 2nd of June ). That and the samples should be enough. Look at them carefully. Regards, Iulian On 12/8/06, rozni yusof <rozniy(a)gmail.com> wrote: > > I still don't have the hang of this thing... the compiler says > "DT_Init cannot be used as a function". It loads and unloads the DLL > ok. > > #include "oldaapi.h" > > void wxloadDlg::WxButton1Click(wxCommandEvent& event) > { > // insert your code here > wxDynamicLibrary dll; > > if(dll.Load("oldaapi32.dll")) wxLogMessage("successful load"); > ECODE *DT_Init, errorcode; > *DT_Init=(ECODE)dll.GetSymbol(wxT("olDaInitialize")); > LPSTR lpszName; > LPHDEV lphDev; > > *DT_Init(lpszName, lphDev); //this line is wrong? > > > dll.Unload(); > if(!dll.IsLoaded()) wxLogMessage ("successful unload"); > } > > On 6/2/06, Iulian-Nicu Serbanoiu <undergraver(a)gmail.com> wrote: > > > > If I think a little I could a general case ( cross platform ) and > > of course the wxDynamicLibrary class can be used cross > > platform ( at least it should ) > > > > // this code is not tested but I'm guessing it is ok in general > > > > #ifdef _WIN32 > > > > // windows specific includes ... > > > > #define DLL_EXPORT __declspec(dllexport) > > > > #else > > > > // unix specific includes .... > > > > #define DLL_EXPORT > > > > #endif > > ....... > > > > #ifdef __cplusplus > > extern "C" { > > #endif > > > > > > DLL_EXPORT int PROCEDURE_00(int param1,int param2); > > > > #ifdef __cplusplus > > } > > #endif > > > > I think this would be more convenient > > > > Regards, > > > > Iulian > > > > > > > > On 6/2/06, Jose Marin <jose_marin2(a)yahoo.com.br > wrote: > > > The wxWidgets part can be used in any platform (Mc, > > > Linux), only change the way the dll are created? > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org > For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org > >
From: "rozni yusof" on 11 Dec 2006 06:38 Err, all right, I've puzzled it out... Some DLL's don't cooperate with it though... and trying to convert a link library suitable for one compiler into one suitable for another is such a pain, and there's no guarantee it'll even work... On 12/8/06, Iulian-Nicu Serbanoiu <undergraver(a)gmail.com> wrote: > I gave you an example in this thread earlier this year ( 2nd of June ). > That and the samples should be enough. > Look at them carefully. > > Regards, > Iulian > > > On 12/8/06, rozni yusof <rozniy(a)gmail.com> wrote: > > > > I still don't have the hang of this thing... the compiler says > > "DT_Init cannot be used as a function". It loads and unloads the DLL > > ok. > > > > #include "oldaapi.h" > > > > void wxloadDlg::WxButton1Click(wxCommandEvent& event) > > { > > // insert your code here > > wxDynamicLibrary dll; > > > > if(dll.Load("oldaapi32.dll")) wxLogMessage("successful load"); > > ECODE *DT_Init, errorcode; > > > *DT_Init=(ECODE)dll.GetSymbol(wxT("olDaInitialize")); > > LPSTR lpszName; > > LPHDEV lphDev; > > > > *DT_Init(lpszName, lphDev); //this line is wrong? > > > > > > dll.Unload(); > > if(!dll.IsLoaded()) wxLogMessage ("successful unload"); > > } > > > > On 6/2/06, Iulian-Nicu Serbanoiu <undergraver(a)gmail.com> wrote: > > > > > > If I think a little I could a general case ( cross platform ) and > > > of course the wxDynamicLibrary class can be used cross > > > platform ( at least it should ) > > > > > > // this code is not tested but I'm guessing it is ok in general > > > > > > #ifdef _WIN32 > > > > > > // windows specific includes ... > > > > > > #define DLL_EXPORT __declspec(dllexport) > > > > > > #else > > > > > > // unix specific includes .... > > > > > > #define DLL_EXPORT > > > > > > #endif > > > ....... > > > > > > #ifdef __cplusplus > > > extern "C" { > > > #endif > > > > > > > > > DLL_EXPORT int PROCEDURE_00(int param1,int param2); > > > > > > #ifdef __cplusplus > > > } > > > #endif > > > > > > I think this would be more convenient > > > > > > Regards, > > > > > > Iulian > > > > > > > > > > > > On 6/2/06, Jose Marin <jose_marin2(a)yahoo.com.br > wrote: > > > > The wxWidgets part can be used in any platform (Mc, > > > > Linux), only change the way the dll are created? > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > wx-users-unsubscribe(a)lists.wxwidgets.org > > For additional commands, e-mail: > wx-users-help(a)lists.wxwidgets.org > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: "Iulian-Nicu Serbanoiu" on 11 Dec 2006 07:04
Tell us what problems you have and I'm sure we can find a cross-platform solution just like the wx library did ;) Regards, Iulian PS: some code would be good On 12/11/06, rozni yusof <rozniy(a)gmail.com> wrote: > > Err, all right, I've puzzled it out... > > Some DLL's don't cooperate with it though... and trying to convert a > link library suitable for one compiler into one suitable for another > is such a pain, and there's no guarantee it'll even work... > > > |