Use MonkeyModule in Nativecode [HELP]

Monkey Forums/Monkey Programming/Use MonkeyModule in Nativecode [HELP]

k.o.g.(Posted 2013) [#1]
Hello all

Can monkey modules used in Native C++ code?

Like StringMaps:
c_StringMap *FieldMap;


or have anybody another idea?



(sry my english is not very good...)


skid(Posted 2013) [#2]
why? c++ already has string map:

std::map<std::string,std::string>


Gerry Quinn(Posted 2013) [#3]
Monkey interfaces fairly easily and understandably to native code, so I guess it would be possible to make it work - but if you can operate within one language it's always simpler...


k.o.g.(Posted 2013) [#4]
Hmm, in my c++file is a class wich i bind extern in monkey.
I would make a StringMap, that i can access from Monkey. any chance to realize that?


Gerry Quinn(Posted 2013) [#5]
Maybe you could make functions for constructing a StringMap in Monkey, which Monkey could then call. If you want your native class to be in control, I guess you could set up some sort of a loop in which it sends a sequence of 'commands' to a Monkey program, and the Monkey code executes a command and calls a native function looking for the next one. Something like the following (I don't do much native code so I'm just thinking aloud):

Extern

Class StringMapGenerator = "stringmapgen"

Field nextItem:StringMapItem

Method GetNextStringMapItem()

End


If it's just a matter of getting the data for the string map to Monkey, though, I think I would try to pass it in the simplest way possible.


k.o.g.(Posted 2013) [#6]
Hmm thanks for your idea...


It would be the simplest way, when mark writes the C++ Lang code before writes own code in main.cpp :)

Can anybody mark asking?