Aha, thank you so much Jukka! It's a C function, so all I had to do was add
the leading underscore. How easy when it comes down to it :)

Thanks very much also for the llvm-nm tip, I was wondering exactly about
that!

Best,
Arve

On Tue, Sep 9, 2014 at 4:38 PM, Jukka Jylänki <[email protected]> wrote:

> The symbols you specify in EXPORTED_FUNCTIONS must be aware of C and C++
> name mangling rules, e.g. if the symbol you are implementing is a C
> function, then specify _chuckMain. If the function is in a C++ file, you
> can use extern "C" directive to force C name mangling rule for a C++
> function to make it easier for exporting. If all else fails, compile the
> output to a .bc file, and use llvm-nm to examine what kind of symbols the
> file actually has compiled into it that you can export.
>
> Jukka
>
>
> 2014-09-09 6:59 GMT+03:00 Arve Knudsen <[email protected]>:
>
>> I forgot to mention that the code lives in branch "emscripten" (
>> https://github.com/aknuds1/chuck/tree/emscripten).
>>
>> Also, I found out in the meantime about exporting C functions with
>> Emscripten, so I added '-s EXPORTED_FUNCTIONS='["chuckMain"]' to the step
>> to build chuck.js. Now emcc says that chuckMain is not implemented: WARNING
>>  root: function requested to be exported, but not implemented: "chuckMain".
>> How come chuckMain isn't detected, what am I doing wrong here?
>>
>> Thanks,
>> Arve
>>
>> On Tue, Sep 9, 2014 at 12:42 PM, Arve Knudsen <[email protected]>
>> wrote:
>>
>>> Hi guys
>>>
>>> I'm at the point where I'm trying to start generating JavaScript library
>>> functions from ChucK (https://github.com/aknuds1/chuck). ChucK is
>>> originally an executable, but I've modified the build procedure to exclude
>>> the main entry point (int main) and instead include a function called
>>> chuckMain (intended as a first library function, simply for testing).
>>>
>>> How do I now generate a ChucK JS library, exposing the function
>>> "chuckMain"? I can't see that chuckMain is present at all in the generated
>>> JS, i.e. chuck.js.
>>>
>>> Thanks,
>>> Arve
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to