You are here:

C++/How to connect C++ application to Javascript functions?

Advertisement


Question
Good day Sir Eddie,

I know that C++ and Visual C++ are a bit different but because C++ is a strongly typed language, there is a big possibility for me to acquire answers from you even if I am using Visual C++ MFC.

I tried to searched on the net about the topic but there are no relevant answers to my question.

Is it possible to connect C++ to Javascript functions? Let us say you have these few lines of codes in html...
FILENAME: hello.html
<html>
<head><title>Sample</title>
<script language="Javascript">
function MyMessage()
{
alert("Hello World");
}
</script>
</head>
<body></body>
</html>

... and I wish to connect my C++ application to my html file. How do I establish connections using C++ codes? Please help.

Thanks in advance and God Bless,
Paolo

Answer
Hello Paolo, thank you for the question.

I've never done this before. However, I know that it can be done by writing JNI bindings that can translate from Java into C++. I have no idea how to do it, but some of our Java experts might know. I have heard of an application called NoodleGlue that is supposed to help with this, but I've never used it.

You should try asking our Java experts this question. They will probably be more knowledgable than I.

- Eddie

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Eddie

Expertise

I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.

Experience

I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.