Page 1 of 1

Using Cef4 in existing project

Posted: Mon Jun 07, 2021 4:38 pm
by ibonetti
Hello,

I´m facing some issues trying to use CEF4 in existing project. If i create an empty project, and configure it to use subProcess(based on de SubProcess demo), it runs fine.
When i add it to an existent application, i get an "SimpleBrowser_sp.exe: entry point procedure could not be located 'SymGetSeacrhPathw. libCeff.dll"
The binaries location are right, as said, other project at the same location runs fine.
If someone can give me a clue, of what could be te problem, maybe an project configuration.

Thanks in advance.

Windows 10 - 64 bits.
Delphi XE3.

Re: Using Cef4 in existing project

Posted: Tue Jun 08, 2021 7:31 am
by salvadordf
Hi,

It's the first time I see that error and it's difficult to say what could be wrong without a code sample or a step by step guide to reproduce it on my pc.

Maybe SimpleBrowser_sp is crashing due to incorrect CEF settings. Enable logging in CEF by setting these properties before the GlobalCEFApp.StartMainProcess and GlobalCEFApp.StartSubProcess calls :

Code: Select all

  GlobalCEFApp.LogFile             := 'debug.log';
  GlobalCEFApp.LogSeverity         := LOGSEVERITY_VERBOSE;
  
You might need to add uCEFConstants to the uses section to resolve the LOGSEVERITY_VERBOSE constant.

Re: Using Cef4 in existing project

Posted: Tue Jun 08, 2021 11:42 am
by ibonetti
Thanks for the reply Salvador,

The log file doesn´t show nothing special.
I tried a different approachs:
1) Disabled de subprocess approach, so the cef will start another instances of my application. I get the same error.
2) Enabled the SingleProcess := true, and disabled the SubProcess. In this scenario it works, but i know that SingleProcess is not for production. It looks like the problem occurs only when try to load dll from another exe(spawned from cef). When using subProcess, the error occurs on the subProcess "SimpleBrowser_sp.exe".
I don´t know if my application has some configuration that can impact the spawned process.

If it helps, the error occurs at uCefApplicationCore.pas, procedure InitializeLibrary. - cef_initialize(@TempArgs, @FAppSettings, aApp.Wrap, FWindowsSandboxInfo).

These are the conclusions i got so far. Any help is appreciated.
Thanks again.

Re: Using Cef4 in existing project

Posted: Wed Jun 09, 2021 8:24 am
by salvadordf
CEF can't be initialized more than once per process. Perhaps this is the cause of the issue here but I'm not sure.

It would help a lot if you can create a minimal example that I could use to reproduce this issue.

Re: Using Cef4 in existing project

Posted: Wed Jun 09, 2021 10:01 am
by ibonetti
Sorry for my confused post.
The InitializeLibrary is called only once, at the main application. I ended up debuging the subprocess exe, and the error occur on LoadLibraryEXw, but only if this subprocess exe is called from my existing app. The same subprocess used in another app, loads the library. That's why I think my app can be affecting the subprocess exe in some way.
It's hard to reproduced in a new project, but I'll try. Because I can't share the other application's code.
Thank you very much.

Re: Using Cef4 in existing project

Posted: Wed Jun 09, 2021 8:54 pm
by ibonetti
After a lot of research, i discovered that the missing entry point "SymGetSeacrhPathw" belongs to dbghelp.dll, that is used by libcef.dll.

I used ProcMon(https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) to analize the subProcess dll loading flow in both cases(the running ok application and the problematic application).
In the running ok application, i saw that dbghelp.dll was being loaded from "C:\windows\SysWow64\".
The problematic application had an entry of loading this lib from "C:\oracle\product\11.2.0\dbhome_1\BIN", maybe, because the main app uses oracle client.

Just for testing, i removed the dll from oracle directory, and like magic, everything is running fine.
As a final solution, i moved the dll back to oracle directory(i don´t know the side effect of remove it), and copied to my application´s directory the dlll from "C:\windows\SysWow64\".

I really don´t understand why the SimpleBrowser_sp.exe was loading library from the oracle client directory. Maybe the main application loaded from there, and the spawned SimpleBrowser_sp.exe uses the same location to load, don´t know, i´m not an expert on dlls loading.

Anyway, thank you very much!