Closed Bug 72083 Opened 24 years ago Closed 16 years ago

Need sample of XPCOM-in-C

Categories

(Core :: XPCOM, defect)

defect
Not set
minor

Tracking

()

RESOLVED WONTFIX
mozilla1.1alpha

People

(Reporter: shaver, Unassigned)

References

Details

Attachments

(1 file)

<J-random-person-in-need-of-component-system> but XPCOM is only for C++ It doesn't have to be true. I'll make it untrue.
Oh yeah, baby. Compile this little mama with: gcc -o c_sample.o gcc -shared -Wl,-h -Wllibcsample.so -o libcsample.so Then copy her into your components directory. I play a little fast-and-loose with QI and refcounting for some of the objects (module, factory), but it all works well enough to let XPConnect create and manipulate it through nsISample.
Status: NEW → ASSIGNED
QA Contact: kandrot → shaver
Er, make that first line: gcc -c c_sample.c (Obviously.)
Attached file c_sample.c, mark 1
With an xpidl mode for C, and some helpful macros, that might actually not be completely unpleasant to work with. Certainly not much worse than CORBA-in-C, and people actually do that. The code as posted will work with gcc-2.96 on Linux. If you want to use another compiler (gcc-3, say), you'll need to replace the crap1/crap2 placeholders in nsISupports_vtbl. If you're on the Mac, you'll need to do something about strdup, whose existance I arrogantly assume. I don't do the correct thing with the allocator, either. Maybe later.
Target Milestone: --- → mozilla1.0
Cool. Now you can start working on nsAReadableString-in-C. ;-)
Not a 1.0 bug.
Target Milestone: mozilla1.0 → mozilla1.1
Depends on: 227240
Need is so strong a word.
Assignee: shaver → nobody
Status: ASSIGNED → NEW
QA Contact: shaver → xpcom
Just say no.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: