Help converting old Blitzmax code that uses Extern

About Monkey 2 Forums Monkey 2 Programming Help Help converting old Blitzmax code that uses Extern

This topic contains 5 replies, has 3 voices, and was last updated by  jondecker76 3 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1635


    I’ve been bashing my face against a wall trying to figure out Externs in monkey2.

    Here is my old BMax code that would grab images from a webcam


    I’ve converted most of the code (minus some threading stuff that isn’t present yet in monkey2)

    But I’m pretty sure that I’m not getting the externs correct, causing  all kinds of problems just trying to compile. Here are my errors trying to compile the module:

    It’s not seeing any of the defined externs
    Any thoughts?






    Here’s the contents of v4l2.c if it helps at all…

    I’ve played with this all day and still the defined Externs refuse to be recognized


    Mark Sibly

    You need a .h file that declares the externs, and the monkey2 code needs to import that too, eg:

    The weird #ifdef __cplusplus stuff is necessary because c and c++ ‘mangle’ names differently. If you make the c file a cpp file instead, you can ditch this.

    Also, you might want to prefix all the native code idents with ‘v412_’ or something to prevent potential name clashes with other native code.


    Simon Armstrong

    From a quick browse I would change Extern Public to plain Extern and add a header file.

    In monkey2, importing “v4l2.c” adds that file to a list for compiling and linking but I’m pretty sure monkey2 needs an additional “v4l2.h” file to be able to compile your monkey2 code.


    Oops too late.



    Thanks guys, I knew it was going to be something that makes a lot of sense once I heard it!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.