[MacRuby-devel] c++ lib
Laurent Sansonetti
lsansonetti at apple.com
Thu May 27 13:31:29 PDT 2010
Hi Louis-Philippe,
BridgeSupport doesn't support C++. It only exposes C and Objective-C symbols.
In your C++ library, what is MYSDK exactly? If it isn't an Objective-C class, it won't be accessible from MacRuby.
In order to use your C++ code in MacRuby, the best way is to wrap the calls you need in Objective-C APIs. You can then access them from MacRuby at no cost. And a bridgesupport file won't be needed.
Laurent
On May 27, 2010, at 12:48 PM, Louis-Philippe wrote:
> I see on the BridgeSupport support to redirect all request to Laurent...
> so here it is...
>
> Laurent,
> Is it desperate to keep trying every options of gen_bridge_metadata?
> will it swallow my c++ framework at some point?
>
> thanks
>
> 2010/5/27 Jordan Breeding <jordan.breeding at me.com>
> Don't know, the only times I have used that method the header file itself is just straight C, the implementation hides all of the C++ in my case. Maybe gen_bridge_metadata doesn't handle C++.
>
> On May 27, 2010, at 11:49, Louis-Philippe wrote:
>
>> any idea why gen_bridge_metadata does spit this:
>>
>> gen_bridge_metadata --64-bit -f ./MYSDK.framework -o MYSDK.bridgesupport
>> ./MYSDK.framework/Headers/MYSDK.h:21:18: error: string: No such file or directory
>> /usr/bin/cpp-4.2 returned 1 exit status
>> line was: /usr/bin/cpp-4.2 -D__APPLE_CPP__ -include /usr/include/AvailabilityMacros.h -F"." "./MYSDK.framework/Headers/MYSDK.h" 2>/tmp/.cpp.err
>> Usage: gen_bridge_metadata [options] <headers...>
>> Use the `-h' flag or consult gen_bridge_metadata(1) for help.
>>
>> it's referring to this line in the SDK header:
>> #include <string>
>>
>> and the SDK uses std::string all over the place...
>> why is it complaining like this?
>>
>>
>> 2010/5/27 Jordan Breeding <jordan.breeding at me.com>
>> You might have to make a bridge support file and include it in your framework.
>>
>> Something like this (although this is specific to running inside my Xcode project build):
>>
>> printf "Building BridgeSupport files...\n\n"
>>
>> BRIDGE_SUPPORT_DIR="Resources/BridgeSupport"
>> BRIDGE_SUPPORT_FILE="${BRIDGE_SUPPORT_DIR}/${TARGET_NAME}.bridgesupport"
>>
>> if [[ "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${TARGET_NAME}" -nt "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}" ]]; then
>> if [[ ! -d "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}" ]]; then
>> mkdir -p "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
>> fi
>> gen_bridge_metadata --64-bit --framework "${TARGET_BUILD_DIR}/${WRAPPER_NAME}" -o "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}"
>> fi
>>
>> On May 27, 2010, at 10:31, Louis-Philippe wrote:
>>
>>> Thanks!
>>> ok... I sorted some of the issues out... I was able to make a x86_64 framework out of the SDK by including the proper exports symbols (using nm with the -arch flag).
>>>
>>> so now it loads fine with the framework method...
>>> but I cant access the c++ namespace:
>>> "NameError: uninitialized constant MYSDK"
>>>
>>> 2010/5/27 Jordan Breeding <jordan.breeding at me.com>
>>> Then you could force macruby/macirb to run as i386:
>>>
>>> `arch -arch i386 macirb`
>>>
>>> On May 27, 2010, at 10:13, Louis-Philippe wrote:
>>>
>>>> it only builds for i386...
>>>> getting errors when trying to build for x86_64...
>>>> thats why I tried as I tested to build only for i386...
>>>>
>>>> 2010/5/27 Jordan Breeding <jordan.breeding at me.com>
>>>> Try building your framework as both i386 and x86_64.
>>>>
>>>> On May 27, 2010, at 10:00, Louis-Philippe wrote:
>>>>
>>>>> file PATH/MYSDK.framework/MYSDK
>>>>> ./MYSDK: Mach-O dynamically linked shared library i386
>>>>>
>>>>> file `which macruby`:
>>>>> /usr/local/bin/macruby: Mach-O universal binary with 2 architectures
>>>>> /usr/local/bin/macruby (for architecture i386): Mach-O executable i386
>>>>> /usr/local/bin/macruby (for architecture x86_64): Mach-O 64-bit executable x86_64
>>>>>
>>>>>
>>>>> 2010/5/27 Louis-Philippe <default at spiralix.org>
>>>>> sorry, the second one really is:
>>>>>
>>>>> ./MYSDK (from the MYSDK.framework)
>>>>> -bash: ./MYSDK: cannot execute binary file
>>>>>
>>>>> 2010/5/27 Louis-Philippe <default at spiralix.org>
>>>>>
>>>>> uname -a:
>>>>> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>>>>>
>>>>> ./MYSDK (from the MYSDK.framework)
>>>>> -bash: ./R3DSDK: No such file or directory
>>>>>
>>>>> which macruby:
>>>>> /usr/local/bin/macruby
>>>>>
>>>>> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the error sample I pasted above is from a macirb execution
>>>>>
>>>>>
>>>>> 2010/5/27 Joel Reymont <joelr1 at gmail.com>
>>>>>
>>>>> Louis-Philippe,
>>>>>
>>>>> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>>>>>
>>>>> > Did find:
>>>>> > /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
>>>>> > from /PATH/(irb):2:in `<main>'
>>>>>
>>>>> Can you paste the output from the following?
>>>>>
>>>>> uname -a
>>>>>
>>>>> file ATH/MYSDK.framework/MYSDK
>>>>>
>>>>> file `which macruby`
>>>>>
>>>>> Thanks, Joel
>>>>>
>>>>> ---
>>>>> http://twitter.com/wagerlabs
>>>>>
>>>>> _______________________________________________
>>>>> MacRuby-devel mailing list
>>>>> MacRuby-devel at lists.macosforge.org
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> MacRuby-devel mailing list
>>>>> MacRuby-devel at lists.macosforge.org
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>
>>>>
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel at lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>
>>>>
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel at lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>>
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>>
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100527/644c1827/attachment-0001.html>
More information about the MacRuby-devel
mailing list