Importing C code
BlitzMax Forums/BlitzMax Programming/Importing C code
| ||
I hope someone can shed some light on this. I read the help topic under "Advanced Topics" dealing with importing C code, copied their "doubler" example and implemented it without problems. Then, I made a functions file out of some of my C++ dlls, named the file "maestro.cpp" and implemented it exactly as the example went. However, I discovered that when I tried to run a test program I got this: Building test Compiling:maestro.cpp Compiling:test.bmx flat assembler version 1.51 3 passes, 2090 bytes. Linking:test.exe D:/test2/.bmx/test.bmx.gui.release.win32.o(code+0xb4): undefined reference to `SetProcessLock' Process complete After fighting with it for a while, I redid the doubler example bit for byte with one tiny change: I called the file "c_funcs.cpp" instead of "c_funcs.c" and I got the same error. Renamed it back to .c and it works fine (yes I remembered to change it in the import statement) If I put c++ -specific statements in a file with a .c extension, Mingw will not compile them. Can anyone tell me how to make this work? I know I must just be missing some minor detail, but it isn't in the help topic. |
| ||
I should point out that 'SetProcessLock' is one of my C functions in the file. The error I got when I did the doubler example was 'undefined reference to 'Doubler' |
| ||
You want an answer? I'll give you an answer. http://www.blitzbasic.com/Community/posts.php?topic=48531 |
| ||
No, the answer to this question is not found anywhere in that topic. My Mingw is set up and running fine. |
| ||
My bad, I forgot the extern keyword in my C++ file. Works fine now |