CefGlue with CEF1 x64

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

CefGlue with CEF1 x64

Postby mnkypete » Thu Nov 07, 2013 5:45 am

Hi all,

I know that this is highly unsupported, but I have the feeling that I'm not that far away from making CefGlue work with CEF1 x64.
I was able to build CEF1 successfully (rev 1453) on 64bit with the diff file that #9 provided (https://code.google.com/p/chromiumembed ... rt=&id=394)

The unit test nearly all pass and it also looks good in cefclient.exe, but if I try to test this with CefGlue, the trouble begins.
There seems to be some problem with the Interop, I tried debugging that, and it seems the pointers are somewhat messed up..

The dump which I have is this:

Code: Select all
00000000`001be210 00000001`81557979 libcef!_CxxThrowException+0x81 [f:\dd\vctools\crt_bld\self_64_amd64\crt\prebuild\eh\throw.cpp @ 157]
00000000`001be280 00000001`80021eda libcef!std::_Xlength_error+0x29 [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\xthrow.cpp @ 14]
00000000`001be2d0 00000001`801e70e3 libcef!std::vector<CefStringBase<CefStringTraitsUTF16>,std::allocator<CefStringBase<CefStringTraitsUTF16> > >::_Xlen+0x2a [c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector @ 1428]
00000000`001be300 00000001`801e6809 libcef!std::vector<CefStringBase<CefStringTraitsUTF16>,std::allocator<CefStringBase<CefStringTraitsUTF16> > >::_Buy+0x73 [c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector @ 1259]
00000000`001be330 00000001`801e675e libcef!std::vector<CefStringBase<CefStringTraitsUTF16>,std::allocator<CefStringBase<CefStringTraitsUTF16> > >::vector<CefStringBase<CefStringTraitsUTF16>,std::allocator<CefStringBase<CefStringTraitsUTF16> > >+0x79 [c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector @ 536]
00000000`001be3c0 00000001`8000e349 libcef!cef_string_list_copy+0xfe [c:\users\tobi\desktop\cef1_x64\chromium\src\cef\libcef\cef_string_list.cc @ 57]
00000000`001be530 00000001`8000e20e libcef!CefSettingsTraits::set+0x119 [c:\users\tobi\desktop\cef1_x64\chromium\src\cef\include\internal\cef_types_wrappers.h @ 281]
00000000`001be570 00000001`800087ec libcef!CefStructBase<CefSettingsTraits>::Set+0x5e [c:\users\tobi\desktop\cef1_x64\chromium\src\cef\include\internal\cef_types_wrappers.h @ 113]
00000000`001be5b0 00007ffe`b7688773 libcef!cef_initialize+0x10c [c:\users\tobi\desktop\cef1_x64\chromium\src\cef\libcef_dll\libcef_dll.cc @ 109]


This occurs when the following call is made in CEF (cef_type_wrappers.h)

Code: Select all
target->extra_plugin_paths = src->extra_plugin_paths ?
        cef_string_list_copy(src->extra_plugin_paths) : NULL;


The strange thing is, there is actually just an empty list passed. So I tried stop passing anything (just an empty pointer, to negate the condition), but when the managed<->native boundary is crossed, the pointer somehow has a value!!
I'm not an expert in the interop stuff, does anyone has an idea what the problem could be? (My guesses were: Wrongly compiled ceflib.dll -> Compiler flags?? or CefGlue not build correctl with version 1453, but I couldn't find any error there.)

//Edit: Some screenshots, before native call:
managed.png
managed.png (227.29 KiB) Viewed 7073 times


After managed<->native transition (it says "bad pointer")
native.png
native.png (260.51 KiB) Viewed 7073 times



Thanks and best regards,
Tobi
mnkypete
Newbie
 
Posts: 8
Joined: Wed Aug 14, 2013 11:15 am

Re: CefGlue with CEF1 x64

Postby mnkypete » Thu Nov 07, 2013 6:05 pm

Okay, I made progress... Seems to be the case that size_t value need to be marshalled as IntPtr instead of just "int", because size_t is long on 64bit..

If anyone is interested, in detail, you need to adapt three files:

alloc.tt (Change int to IntPtr, line 71 + Cast, line 75)
Code: Select all
        private static IntPtr s_size;

        static <#=def.Name#>()
        {
            s_size = (IntPtr) Marshal.SizeOf(typeof(<#=def.Name#>));
        }


Change s_size from int to IntPtr in:
cef_browser_settings_t.cs
cef_settings_t.cs

Best regards & keep up the good work,
Tobi
mnkypete
Newbie
 
Posts: 8
Joined: Wed Aug 14, 2013 11:15 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 15 guests