Call UNO executable in C (not C++)?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
faustf
Posts: 3
Joined: Thu Aug 25, 2022 9:45 am

Call UNO executable in C (not C++)?

Post by faustf »

Hi
like of title , is possible call UNO executable in pure C (not in C++), if yes anyone have some example ??
(like open calc insert hello world in first cell close and save )
thanks to all those who want to answer me
Last edited by MrProgrammer on Thu Sep 08, 2022 6:05 pm, edited 1 time in total.
Reason: Changed subject to add detail
openoffice 4.1.7 on linux mint Mint 20.3 Una 64-bit
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: is possible call UNO executable in pure C

Post by Zizi64 »

There are some informations in the table of this site:
https://wiki.openoffice.org/wiki/Docume ... vanced_UNO
Last edited by Zizi64 on Fri Aug 26, 2022 7:23 am, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: is possible call UNO executable in pure C

Post by Zizi64 »

____________________________________________
openoffice 6.4.7.2 on linux mint Mint 20.3 Una 64-bit
That version is NOT Apache OpenOffice. It is LibreOffice. There are differences in the API-s by now. Please fix your signature.

LibreOffice related informations:

https://wiki.documentfoundation.org/Doc ... vanced_UNO
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
faustf
Posts: 3
Joined: Thu Aug 25, 2022 9:45 am

Re: is possible call UNO executable in pure C

Post by faustf »

thanks i saw just information in wiki but unfortunately all example not work and i ask also if is possible some example worked thanks
openoffice 4.1.7 on linux mint Mint 20.3 Una 64-bit
User avatar
MrProgrammer
Moderator
Posts: 4895
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Is it possible call UNO executable in pure C?

Post by MrProgrammer »

faustf wrote: Thu Aug 25, 2022 9:49 am Is possible call UNO executable in pure C (not in C++) …??
UNO uses objects. Comparison of programming languages shows that C++ supports objects, but C does not. This seems like a fundamental problem. You may have to develop interfaces in C++ for your C programs to call. The interfaces would manipulate the UNO objects and pass their properties in or out to C, or call UNO methods for C. I am using the word interface in the general programming sense, and not referring to an UNO interface.
Developing C wrapper API for Object-Oriented C++ code

Exception handling syntax shows that C does not support exceptions.
"It is the programmer's responsibility to prevent errors in the first place and test return values from the functions."
It may be difficult for your project to avoid situations where UNO would raise an exception. Perhaps you could develop interfaces in C++ to catch exceptions and somehow return that information to C.

Calling UNO from C might be possible (as you asked) but impractical (thus not something you would want to do).

faustf wrote: Fri Aug 26, 2022 4:32 pm … some example worked …
The forum has a search feature. General web search tools exist too. You would know better than I what discoveries might help with your project goals.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Is it possible call UNO executable in pure C?

Post by JeJe »

Implementing objects in C:

https://www.ibm.com/docs/en/rhapsody/8. ... jects-in-c

Maybe a C forum would be a better place for this question? Starting the first part, opening calc, is presumably an easy and ordinary operation?

I only know VB and Windows and there are workarounds using the Windows Api which might do the rest of what you ask without automation - find the calc window by its classname perhaps, send it the text, and then the shortcut keys to close and save. Perhaps Linux has something similar if it can't be done directly to do it indirectly?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
faustf
Posts: 3
Joined: Thu Aug 25, 2022 9:45 am

Re: Is it possible call UNO executable in pure C?

Post by faustf »

thanks at all for rply in windows i know is possible with object COM but linux i think not have therfore i ask about UNO thanks at all again
openoffice 4.1.7 on linux mint Mint 20.3 Una 64-bit
Post Reply