Photon app features in a shared lib?

Hi all,
I would like an application to access library functions that would be either Photon or text-based.
Example: The application calls GetPIN(). The text-based implementation of GetPIN() asks for a pin and return it. The Photon lib version of GetPIN()would pop a numeric keyboard (build with PhAB) and return the PIN entered when OK is pressed.
Any clues or insight are welcome!
Thanks

I don’t recall the exact details, but we did something like this by doing a test at startup and having a flag to say we were running the photon version. The flag was set by trying to dlsym() a function from the photon lib. If it succeeded, we assumed we were linked into a photon app.

Rick…

OK, looks pretty much like what I want to do. Now, is there a way to call PtInit() and PtMainLoop() outside of main()? I would like the main app to keep control of it’s main(). Can the photon main loop live in a thread?
Thanks
Martin

Sure, the only difference between the main thread and the one you create is the behaviour when you call return. In the main thread, return exist the app. In a new thread, return just exits the thread.

Make sure you read all the stuff about using Photon from a multi-threaded environment (only an issue if you use photon calls in more than one thread).

Rick…