f



RE: Re: Re: wxMac: loading a dynamic library with wxDynamicLibrary fails (NSCreateObjectFileImageFromFile fails)

Hi Bernhard

thanks for testing, I'll look at it, perhaps using CFBundle would give a
more versatile implementation at least for wxMac. Is there a reason why
we must use=20
NSCreateObjectFileImageFromFile ?

Best,

Stefan=20

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Bernard=20
> Krummenacher
> Sent: Samstag, 1. April 2006 15:13
> To: wx-users@lists.wxwindows.org
> Subject: Re: Re: wxMac: loading a dynamic library with=20
> wxDynamicLibrary fails (NSCreateObjectFileImageFromFile fails)
>=20
> Stefan Csomor <csomor <at> advancedconcepts.ch> writes:
>=20
> >=20
> > Hi
> >=20
> > if you'd use CFBundle calls do they give better error codes ?
> >=20
> > Best,
> >=20
> > Stefan
> >=20
>=20
> Hi Stefan,
>=20
> Trying to load the bundle with CFBundle seems to work. I did=20
> this (borrowed from
> Apple documentation):
>=20
>     CFURLRef bundleURL;
>     CFBundleRef myBundle;
>  =20
>     // Make a CFURLRef from the CFString representation of the=20
>     // bundle's path.
>     bundleURL =3D CFURLCreateWithFileSystemPath(kCFAllocatorDefault,=20
>                                             CFSTR("<Some=20
> valid absolute
> path>/DynLib.bundle"),
>                                             kCFURLPOSIXPathStyle,
>                                             true );
>    =20
>     // Make a bundle instance using the URLRef.
>=20
>     myBundle =3D CFBundleCreate( kCFAllocatorDefault, bundleURL );
>=20
> myBundle is assigned a non NULL value. Using an invalid path=20
> assignes a NULL
> value, which is expected.
> I didn't try to go further to try to find symbols as my goal is to use
> wxDynamicLibrary as my application is required to work on=20
> both OSX and Windows.
>=20
> Using wxDynamicLibrary leads to the dlopen() function that=20
> use the following NS
> call in dlunix.cpp:
>=20
>   void *dlopen(const char *path, int WXUNUSED(mode) /* mode=20
> is ignored */)
>   {
>     NSObjectFileImage ofile;
>     NSModule handle =3D NULL;
>=20
>     int dyld_result =3D NSCreateObjectFileImageFromFile(path, &ofile);
>     if ( dyld_result !=3D NSObjectFileImageSuccess )
>     { ...
>=20
> Whatever the path, valid or not, the=20
> NSCreateObjectFileImageFromFile() always
> returns "NSObjectFileImageInappropriateFile".
>=20
> Strange, isn't it?
>=20
> Bernard
>=20
>=20
>=20
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help@lists.wxwidgets.org
>=20
>=20

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
csomor
4/1/2006 1:14:39 PM
comp.soft-sys.wxwindows 21076 articles. 0 followers. Post Follow

10 Replies
634 Views

Similar Articles

[PageSpeed] 44

Hi Stefan,

I'd like to comment on this since I was dealing with this issue about a
month ago.  My project is currently using dylibs instead of frameworks
or bundles.  I'd personally like to move away from the former to the
latter, but this is what I have to work with right now.  At any rate,
my understanding is that NSCreateObjectFileImageFromFile won't work
with dylibs.

So I ended up changing dlunix.cpp for my purposes so that the
Darwin-specific code was turned off and that the standard dlopen /
dlclose calls were used.  This allowed me to use dynamic libs just
fine.

Granted my solution isn't optimal for wxWidgets
backwards-compatibility, since I hear that dylibs weren't supported
until 10.3.

- Stephen


"Stefan Csomor" wrote:
> Hi Bernhard
>
> thanks for testing, I'll look at it, perhaps using CFBundle would give a
> more versatile implementation at least for wxMac. Is there a reason why
> we must use
> NSCreateObjectFileImageFromFile ?
>
> Best,
>
> Stefan
>
> > -----Original Message-----
> > From: news [mailto:news@sea.gmane.org] On Behalf Of Bernard
> > Krummenacher
> > Sent: Samstag, 1. April 2006 15:13
> > To: wx-users@lists.wxwindows.org
> > Subject: Re: Re: wxMac: loading a dynamic library with
> > wxDynamicLibrary fails (NSCreateObjectFileImageFromFile fails)
> >
> > Stefan Csomor <csomor <at> advancedconcepts.ch> writes:
> >
> > >
> > > Hi
> > >
> > > if you'd use CFBundle calls do they give better error codes ?
> > >
> > > Best,
> > >
> > > Stefan
> > >
> >
> > Hi Stefan,
> >
> > Trying to load the bundle with CFBundle seems to work. I did
> > this (borrowed from
> > Apple documentation):
> >
> >     CFURLRef bundleURL;
> >     CFBundleRef myBundle;
> >
> >     // Make a CFURLRef from the CFString representation of the
> >     // bundle's path.
> >     bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
> >                                             CFSTR("<Some
> > valid absolute
> > path>/DynLib.bundle"),
> >                                             kCFURLPOSIXPathStyle,
> >                                             true );
> >
> >     // Make a bundle instance using the URLRef.
> >
> >     myBundle = CFBundleCreate( kCFAllocatorDefault, bundleURL );
> >
> > myBundle is assigned a non NULL value. Using an invalid path
> > assignes a NULL
> > value, which is expected.
> > I didn't try to go further to try to find symbols as my goal is to use
> > wxDynamicLibrary as my application is required to work on
> > both OSX and Windows.
> >
> > Using wxDynamicLibrary leads to the dlopen() function that
> > use the following NS
> > call in dlunix.cpp:
> >
> >   void *dlopen(const char *path, int WXUNUSED(mode) /* mode
> > is ignored */)
> >   {
> >     NSObjectFileImage ofile;
> >     NSModule handle = NULL;
> >
> >     int dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
> >     if ( dyld_result != NSObjectFileImageSuccess )
> >     { ...
> >
> > Whatever the path, valid or not, the
> > NSCreateObjectFileImageFromFile() always
> > returns "NSObjectFileImageInappropriateFile".
> >
> > Strange, isn't it?
> >
> > Bernard
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
> > For additional commands, e-mail: wx-users-help@lists.wxwidgets.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
SJBartnikowski
4/3/2006 6:09:03 PM
I seem to remember getting it to work by using the full path to the
binary in the bundle rather than the path just to the bundle folder.

0
jtg
4/3/2006 7:14:43 PM
 <SJBartnikowski <at> gmail.com> writes:

> 
> 
> Hi Stefan,
> 
> I'd like to comment on this since I was dealing with this issue about a
> month ago.  My project is currently using dylibs instead of frameworks
> or bundles.  I'd personally like to move away from the former to the
> latter, but this is what I have to work with right now.  At any rate,
> my understanding is that NSCreateObjectFileImageFromFile won't work
> with dylibs.
> 
> So I ended up changing dlunix.cpp for my purposes so that the
> Darwin-specific code was turned off and that the standard dlopen /
> dlclose calls were used.  This allowed me to use dynamic libs just
> fine.
> 
> Granted my solution isn't optimal for wxWidgets
> backwards-compatibility, since I hear that dylibs weren't supported
> until 10.3.
> 
> - Stephen
> 

Stephen,

Working with dylibs would be OK for me as a temporary solution.

Would you be kind enough to share your implementation of dlunix.cpp with the
community?
This would help me a lot.

Thanks in advance.

Bernard



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
gname
4/4/2006 4:44:48 PM
I have had my .dylib worked.

Firstly, I use following extra options on linking .dylib files.
-bundle -exported_symbols_list export_functions.lst

export_functions.lst is something like .def file on Windows platform
which lists the exported function with format,
_function1
_function2
....
In my situation, list file is named seed.lst and has lines,
_GetSeedType
_GetSeedDescription
_GetSeedHalfLife
_CreateSeed

Then, here are the codes on calling functions inside .dylib.

wxDynamicLibrary m_dlModule;

const wxString strGetSeedType( wxT("GetSeedType") );
const wxString strGetSeedDescription( wxT("GetSeedDescription") );
const wxString strGetSeedHalfLife( wxT("GetSeedHalfLife") );
const wxString strCreateSeed( wxT("CreateSeed") );

wxString (* GetSeedTypeProc)( void );
wxString (* GetSeedDescriptionProc)( void );
double   (* GetSeedHalfLifeProc)( void );
ISeed *  (* CreateSeedProc)( void );

....
if ( m_dlModule.Load( strFileName ) )
{
    if ( ! m_dlModule.HasSymbol( strGetSeedType ) ||
        ! m_dlModule.HasSymbol( strGetSeedDescription ) ||
         ! m_dlModule.HasSymbol( strGetSeedHalfLife ) ||
         ! m_dlModule.HasSymbol( strCreateSeed ) )
    {
        wxLogWarning( XLOADSTR( IDS_FAILSEARCHINGSEEDPROC ) );
        return false;
    }
    else
    {
        * (void * *) (&GetSeedTypeProc) = m_dlModule.GetSymbol(
strGetSeedType );
        * (void * *) (&GetSeedDescriptionProc) = m_dlModule.GetSymbol(
strGetSeedDescription );
        * (void * *) (&GetSeedHalfLifeProc) = m_dlModule.GetSymbol(
strGetSeedHalfLife );
        * (void * *) (&CreateSeedProc) = m_dlModule.GetSymbol(
strCreateSeed );
        if ( NULL == GetSeedTypeProc || NULL == GetSeedDescriptionProc
||
             NULL == GetSeedHalfLifeProc || NULL == CreateSeedProc )
        {
            wxLogWarning( XLOADSTR( IDS_FAILLOADINGSEEDPROC ) );
            return false;
        }
        else
        {
            m_strSeedType = (* GetSeedTypeProc)();
            m_strSeedDescription = (* GetSeedDescriptionProc)();
            m_dHalfLife = (* GetSeedHalfLifeProc)();
            return true;
        }
    }
}
else
{
    wxLogWarning( XLOADSTR( IDS_FAILLOADINGSEEDMODULE ) + wxT("\n") +
                  strFileName );
    return false;
}

0
saga
4/6/2006 12:53:24 AM
ps. Those codes worked on my iBook G4 with OS X 10.4.

0
saga
4/6/2006 12:55:35 AM
saga <xunji.luo <at> gmail.com> writes:

> 
> 
> I have had my .dylib worked.
> 
> Firstly, I use following extra options on linking .dylib files.
> -bundle -exported_symbols_list export_functions.lst
> 
> export_functions.lst is something like .def file on Windows platform
> which lists the exported function with format,
> _function1
> _function2

Thanks for your explanations and sample code. Unfortunately, I still cannot make
it to work.

As I wrote in a previous post, the problem seems to be more linked with the
configuration of the caller application and not in the .dylib itself.

I hope Stefan will come with a solution soon.

Bernard




---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
gname
4/6/2006 6:51:00 PM
Stefan Csomor <csomor <at> advancedconcepts.ch> writes:

> 
> Hi Bernhard
> 
> thanks for testing, I'll look at it, perhaps using CFBundle would give a
> more versatile implementation at least for wxMac. Is there a reason why
> we must use 
> NSCreateObjectFileImageFromFile ?
> 
> Best,
> 
> Stefan 

I decided to rewrite the dlunix.cpp file using CFBundle. It works without a
glitch. Here is the full content of the modified dlunix.cpp file:

--------------Start of source code---------------------

/////////////////////////////////////////////////////////////////////////////
// Name:        unix/dlunix.cpp
// Purpose:     Unix-specific part of wxDynamicLibrary and related classes
// Author:      Vadim Zeitlin, modified by Bernard Krummenacher
// Modified by:
// Created:     2005-01-16 (extracted from common/dynlib.cpp)
// RCS-ID:      $Id: dlunix.cpp,v 1.11 2005/04/19 12:38:24 SC Exp $
// Copyright:   (c) 2000-2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

// ============================================================================
// declarations
// ============================================================================

// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------

#include  "wx/wxprec.h"

#ifdef __BORLANDC__
  #pragma hdrstop
#endif

#if wxUSE_DYNLIB_CLASS

#include "wx/dynlib.h"
#include "wx/ffile.h"

#ifndef WX_PRECOMP
    #include "wx/intl.h"
    #include "wx/log.h"
#endif

// only Mac OS X 10.3+ has dlfcn.h, and it is simpler to always provide our own
// wrappers using the native functions instead of doing checks for OS version
#ifndef __DARWIN__
    #include <dlfcn.h>
#endif

// if some flags are not supported, just ignore them
#ifndef RTLD_LAZY
    #define RTLD_LAZY 0
#endif

#ifndef RTLD_NOW
    #define RTLD_NOW 0
#endif

#ifndef RTLD_GLOBAL
    #define RTLD_GLOBAL 0
#endif


#if defined(HAVE_DLOPEN) || defined(__DARWIN__)
    #define USE_POSIX_DL_FUNCS
#elif !defined(HAVE_SHL_LOAD)
    #error "Don't know how to load dynamic libraries on this platform!"
#endif

//#include <Carbon.h>

#ifdef __APPLE_CC__
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFPlugInCOM.h>
#else
#include <CFPlugIn.h>
#include <CFPlugInCOM.h>
#endif

// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------

// standard shared libraries extensions for different Unix versions
#if defined(__HPUX__)
    const wxChar *wxDynamicLibrary::ms_dllext = _T(".sl");
#elif defined(__DARWIN__)
    const wxChar *wxDynamicLibrary::ms_dllext = _T(".bundle");
#else
    const wxChar *wxDynamicLibrary::ms_dllext = _T(".so");
#endif

// ============================================================================
// wxDynamicLibrary implementation
// ============================================================================

// ----------------------------------------------------------------------------
// dlxxx() emulation for Darwin
// ----------------------------------------------------------------------------

#if defined(__DARWIN__)
// ---------------------------------------------------------------------------
// For Darwin/Mac OS X
//   supply the sun style dlopen functions in terms of Darwin NS*
// ---------------------------------------------------------------------------

/* Porting notes:
 *   The dlopen port is a port from dl_next.xs by Anno Siegel.
 *   dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
 *   The method used here is just to supply the sun style dlopen etc.
 *   functions in terms of Darwin NS*.
 */

#include <stdio.h>
#include <mach-o/dyld.h>

static char dl_last_error[1024];

static
void TranslateError(const char *path, int number)
{
  sprintf(dl_last_error, "%s(%d): %s\n", path, number,wxSysErrorMsg(number));
}

const char *dlerror()
{
    return dl_last_error;
}

void *dlopen(const char *path, int WXUNUSED(mode) /* mode is ignored */)
{
  CFURLRef bundleURL;
  CFBundleRef bundle;
  
  // Make a CFURLRef from the CFString representation of the 
  // bundle’s path.
  bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, 
                                            CFStringCreateWithCString(NULL,
                                            path,kCFStringEncodingUTF8),
                                            kCFURLPOSIXPathStyle,
                                            true);
    
  // Make a bundle instance using the URLRef.
  bundle = CFBundleCreate( kCFAllocatorDefault, bundleURL );
  if ( !bundle )
  {
    TranslateError(path, errno);
  }
  // Any CF objects returned from functions with "create" or 
  // "copy" in their names must be released by us!
  CFRelease( bundleURL );
  return bundle;
}

int dlclose(void *handle)
{
    CFBundleUnloadExecutable((CFBundleRef)handle);
    return 0;
}

void* dlsym(void* handle, const char* symbol)
{
  void* func_symbol = CFBundleGetFunctionPointerForName(CFBundleRef(handle),
                        CFStringCreateWithCString(NULL,symbol,
                                                  kCFStringEncodingUTF8));
  return func_symbol;
}

#endif // defined(__DARWIN__)

// ----------------------------------------------------------------------------
// loading/unloading DLLs
// ----------------------------------------------------------------------------

wxDllType wxDynamicLibrary::GetProgramHandle()
{
#ifdef USE_POSIX_DL_FUNCS
   return dlopen(0, RTLD_LAZY);
#else
   return PROG_HANDLE;
#endif
}

/* static */
wxDllType wxDynamicLibrary::RawLoad(const wxString& libname, int flags)
{
    wxASSERT_MSG( !(flags & wxDL_NOW) || !(flags & wxDL_LAZY),
                  _T("wxDL_LAZY and wxDL_NOW are mutually exclusive.") );

#ifdef USE_POSIX_DL_FUNCS
    // we need to use either RTLD_NOW or RTLD_LAZY because if we call dlopen()
    // with flags == 0 recent versions of glibc just fail the call, so use
    // RTLD_NOW even if wxDL_NOW was not specified
    int rtldFlags = flags & wxDL_LAZY ? RTLD_LAZY : RTLD_NOW;

    if ( flags & wxDL_GLOBAL )
        rtldFlags |= RTLD_GLOBAL;

    wxDllType result = dlopen(libname.fn_str(), rtldFlags);
    if (result == NULL)
    {
      const char* xx = dlerror();
      printf("%s\n",xx);
    }
    return result;
#else // !USE_POSIX_DL_FUNCS
    int shlFlags = 0;

    if ( flags & wxDL_LAZY )
    {
        shlFlags |= BIND_DEFERRED;
    }
    else if ( flags & wxDL_NOW )
    {
        shlFlags |= BIND_IMMEDIATE;
    }

    return shl_load(libname.fn_str(), shlFlags, 0);
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS
}

/* static */
void wxDynamicLibrary::Unload(wxDllType handle)
{
#ifdef wxHAVE_DYNLIB_ERROR
    int rc =
#endif

#ifdef USE_POSIX_DL_FUNCS
    dlclose(handle);
#else // !USE_POSIX_DL_FUNCS
    shl_unload(handle);
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS

#if defined(USE_POSIX_DL_FUNCS) && defined(wxHAVE_DYNLIB_ERROR)
    if ( rc != 0 )
        Error();
#endif
}

/* static */
void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name)
{
    void *symbol;

#ifdef USE_POSIX_DL_FUNCS
    symbol = dlsym(handle, name.fn_str());
#else // !USE_POSIX_DL_FUNCS
    // note that shl_findsym modifies the handle argument to indicate where the
    // symbol was found, but it's ok to modify the local handle copy here
    if ( shl_findsym(&handle, name.fn_str(), TYPE_UNDEFINED, &symbol) != 0 )
        symbol = 0;
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS

    return symbol;
}

// ----------------------------------------------------------------------------
// error handling
// ----------------------------------------------------------------------------

#ifdef wxHAVE_DYNLIB_ERROR

/* static */
void wxDynamicLibrary::Error()
{
#if wxUSE_UNICODE
    wxWCharBuffer buffer = wxConvLocal.cMB2WC( dlerror() );
    const wxChar *err = buffer;
#else
    const wxChar *err = dlerror();
#endif

    wxLogError(wxT("%s"), err ? err : _("Unknown dynamic library error"));
}

#endif // wxHAVE_DYNLIB_ERROR

// ----------------------------------------------------------------------------
// listing loaded modules
// ----------------------------------------------------------------------------

// wxDynamicLibraryDetails declares this class as its friend, so put the code
// initializing new details objects here
class wxDynamicLibraryDetailsCreator
{
public:
    // create a new wxDynamicLibraryDetails from the given data
    static wxDynamicLibraryDetails *
    New(unsigned long start, unsigned long end, const wxString& path)
    {
        wxDynamicLibraryDetails *details = new wxDynamicLibraryDetails;
        details->m_path = path;
        details->m_name = path.AfterLast(_T('/'));
        details->m_address = wx_reinterpret_cast(void *, start);
        details->m_length = end - start;

        // try to extract the library version from its name
        const size_t posExt = path.rfind(_T(".so"));
        if ( posExt != wxString::npos )
        {
            if ( path.c_str()[posExt + 3] == _T('.') )
            {
                // assume "libfoo.so.x.y.z" case
                details->m_version.assign(path, posExt + 4, wxString::npos);
            }
            else
            {
                size_t posDash = path.find_last_of(_T('-'), posExt);
                if ( posDash != wxString::npos )
                {
                    // assume "libbar-x.y.z.so" case
                    posDash++;
                    details->m_version.assign(path, posDash, posExt - posDash);
                }
            }
        }

        return details;
    }
};

/* static */
wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded()
{
    wxDynamicLibraryDetailsArray dlls;

#ifdef __LINUX__
    // examine /proc/self/maps to find out what is loaded in our address space
    wxFFile file(_T("/proc/self/maps"));
    if ( file.IsOpened() )
    {
        // details of the module currently being parsed
        wxString pathCur;
        unsigned long startCur = 0,
                      endCur = 0;

        char path[1024];
        char buf[1024];
        while ( fgets(buf, WXSIZEOF(buf), file.fp()) )
        {
            // format is: start-end perm something? maj:min inode path
            unsigned long start, end;
            switch ( sscanf(buf,
                            "%08lx-%08lx %*4s %*08x %*02d:%*02d %*d %1024s\n",
                            &start, &end, path) )
            {
                case 2:
                    // there may be no path column
                    path[0] = '\0';
                    break;

                case 3:
                    // nothing to do, read everything we wanted
                    break;

                default:
                    // chop '\n'
                    buf[strlen(buf) - 1] = '\0';
                    wxLogDebug(_T(
                      "Failed to parse line \"%s\" in /proc/self/maps."),buf);
                    continue;
            }

            wxString pathNew = wxString::FromAscii(path);
            if ( pathCur.empty() )
            {
                // new module start
                pathCur = pathNew;
                startCur = start;
                endCur = end;
            }
            else if ( pathCur == pathNew )
            {
                // continuation of the same module
                wxASSERT_MSG(start == endCur, _T("hole in /proc/self/maps?"));
                endCur = end;
            }
            else // end of the current module
            {
                dlls.Add(wxDynamicLibraryDetailsCreator::New(startCur,
                                                             endCur,
                                                             pathCur));
                pathCur.clear();
            }
        }
    }
#endif // __LINUX__

    return dlls;
}

#endif // wxUSE_DYNLIB_CLASS

---------------End of source code----------------------

With this modification, using wxDynamicLibrary with .bundle dynamic libraries is
straightforward.

I can post a link to sample projects if someone is interested.

Bernard




---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
gname
4/9/2006 1:10:32 PM
On Sun, 9 Apr 2006 13:10:32 +0000 (UTC) Bernard Krummenacher <gname@silicon-peace.com> wrote:

BK> I decided to rewrite the dlunix.cpp file using CFBundle. It works without a
BK> glitch.

 But is the functionality of the old code still preserved after these
changes? There are people relying on what the current code does...

BK> Here is the full content of the modified dlunix.cpp file:
[...many #ifdef __DARWIN__ ...]

 Just one small request: I've already extracted dlunix.cpp from
common/dynlib.cpp to reduce the #ifdef mess, please don't put more #ifdefs
in this file. The Darwin implementation is completely different and so
should be in its own file, e.g. src/mac/corefoundation/dlmac.cpp.

 Thanks,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
vadim
4/9/2006 2:55:45 PM
Vadim Zeitlin <vadim <at> wxwindows.org> writes:

> 
> On Sun, 9 Apr 2006 13:10:32 +0000 (UTC) Bernard Krummenacher <gname <at>
silicon-peace.com> wrote:
> 
> BK> I decided to rewrite the dlunix.cpp file using CFBundle. It works without a
> BK> glitch.
> 
>  But is the functionality of the old code still preserved after these
> changes? There are people relying on what the current code does...
> 
> BK> Here is the full content of the modified dlunix.cpp file:
> [...many #ifdef __DARWIN__ ...]
> 
>  Just one small request: I've already extracted dlunix.cpp from
> common/dynlib.cpp to reduce the #ifdef mess, please don't put more #ifdefs
> in this file. The Darwin implementation is completely different and so
> should be in its own file, e.g. src/mac/corefoundation/dlmac.cpp.
> 
>  Thanks,
> VZ
> 

Vadim,

In fact, I just replaced the NS... calls by the CFBundle ones in the existing
file. The only #ifdef I added was this one for the inclusion of the required
header files:

//#include <Carbon.h>

#ifdef __APPLE_CC__
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFPlugInCOM.h>
#else
#include <CFPlugIn.h>
#include <CFPlugInCOM.h>
#endif

All the other ones are part of the 6.2.3 distribution.

bernard





---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
gname
4/9/2006 11:02:28 PM
On Sun, 9 Apr 2006 23:02:28 +0000 (UTC) Bernard Krummenacher <gname@silicon-peace.com> wrote:

BK> In fact, I just replaced the NS... calls by the CFBundle ones in the existing
BK> file. The only #ifdef I added was this one for the inclusion of the required
BK> header files:

 Oops, sorry, I didn't realize the Darwin code was already in this file. It
still should be removed from it, of course, but it has nothing to do with
your patch, of course.

 Thanks for the explanation,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
vadim
4/9/2006 11:53:11 PM
Reply: