Inline functions call Code Composer 5.4.0 - inline

I am suffering with a bizarre issue came up in the code am working in Code Composer.
That is,in the code am working on there are some inline functions called,through an .inl file.Everything seem fine so far,the problem comes when instead of calling and executing that function,a Visual studio (or other default program for defined for editing your code) comes up and in the screen and the pointer passed to the function becomes null while it was not...
Thanks very much!

You can check the disassembly for your code. The assembly for the inline function should be directly inserted there. Check to see if that is happening. If not, it is your compiler that has an issue.
Why don't you try putting the inline functions in a .hpp file and see if you get the same problem?

Related

Keep getting indentifier undefined error in C using any ide

So this is my first post. I am preparing for some upcoming college courses on programming, one of them deals with C. I have been teaching myself for a little while and have never encountered this problem before, even though I have used the same code. I am having the issue on any ide that I use, which are MS Visual Studio 2019, and Codeblocks, both 16.01 and 17.12.
The problem is when I try to include an inline function, the compiler brings up an error: identifier "keep_window_open" is undefined, as well as the error: 'keep_window_open':identifier not found.
This never happened until I upgraded Codeblocks from 16.01 to 17.12, so that leads to believe something happened with the compiler or some settings that I don't know about, or how to change.
I have tried going back to Codeblocks 16.01, but still get the same error. All my previous programs, that use the exact same code still compile and run, so I am at a lost and completely frustrated. Enough so to think about changing my major, which I really do not want to do. I enjoy programming. But this problem is killing me.
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
inline void keep_window_open() { char ch; scanf("%s", ch); }
int main()
{
printf ("Lets see if this stupid thing works\n");
keep_Window_open();
return 0;
}
The problem is the line of code:
keep_Window_open();
If I comment it out, the program will compile and run, however I can't see it, because all it does is flash and then close the console window. And I need to use this code to see the output window. As I have said I have used this code in many other programs, most of which are much more complex than this, and they all still compile and run. It is only on new projects that I try to create.
I expect the window to stay open until the user presses and enters a key, like it always has before. I am stuck, and would appreciate some input on how to proceed, other than throw myself in front of a bus.
OK, so I was able to solve the issue in CodeBlocks, but not in Visual Studio. I changed the code to have the inline function below the main function, and now when compiled and run in CodeBlocks (17.12) it works exactly like it should, or how I thought it should.
However when I try the same solution in Visual Studio, after putting the inline function below the main function I now get a new error:
'keep_window_open' redefinition basic types
Since I usually use CodeBlocks for C, Visual Studio for C++ and intellij for java, I am not going to worry about this, as long as it works in CodeBlocks I should be OK. However I am curious as to why it work in one IDE and not the other?
I am new to this programming thing, and there is much to learn, and I know virtually nothing about compilers and linkers, as I am focusing on programming techniques and syntax in several different languages.

Every IDE falls into disassembly mode during debugging

I have installed Linux (Ubuntu 16.04) recently, then QtCreator. Every time when I try to debug my C program in it, it falls into disassembly mode, it means when I try to step into, or even step over, it opens a file "Disassasembly(...)" and navigates in this file. It happens not only for standard functions like malloc (which source code I don't have), but also for my own functions. I thought it's because of the IDE, and installed NetBeans - and I have exactly the same problem in it.
Some example:
[it is shown after stepping over my function, and this function is just the beginning of my program, but the program ends after this screen] - edit: sorry I had to remove this file, because I can post only 2 links..
Another problem is when even for a short moment it navigates on my code (not on disassembly), it executes lines which contains documentation, and gets out to the body of another fuction, which isn't called by me at all(!) It looks like a mess...
So, I think it might be some problem with GDB, but I have no idea how to solve it. Could you help me?
GDB v. 7.11.1
gcc v. 5.4.0
NetBeans v. 8.2
EDIT: It became really weird. Today, when I tried to debug it once again, without any changes in code nor settings, the debugger started to behave almost normally, it means, that it steps through my code correctly now. The only moment, when it falls into dissasembly mode, is the end of my program, when last instruction has executed and it should end. This screens should help:
(1)
(2)
EDIT2: Ok, maybe it is quite normal now. But I still have no idea, what was wrong, and what solved the problem. I hope that it won't come back :)

LLVM JIT : how to disable automatic function resolve?

I was surprised to see that adding an a-priori non defined "double sin(double)" function in a C code that is JIT'ed actually worked... This is explained in LLVM doc, the JIT engine automatically falls back to dlsym("sin") which works as my code was linked with libm
However, I want to avoid this and have no built-in function in my JIT'ed code! How can I disable this behavior?
Thanks
You can call ExecutionEngine::DisableSymbolSearching(true) to disable automatically resolving with the linked code.

lowlevellock: robust_lock_wait function not found

I downloaded and compiled the header which is used in pthread functions. But one function is missing and that is *__lll_robust_lock_wait*. Now I noticed that there is an assembly code header out there, . I downloaded this and tried to compile it using the usual the compile command "as lowlevelrobustlock.S" and I got nearly 100 compiler errors. Is there a simpler version of the function I mentioned that will actually compile and be useful?
The assembly code header can be found here

Something wrong with C wrapper for Matlab

I'm currently facing an apparently silly problem with Matlab but I just can't figure out what is wrong (or better yet, I think it is wrong, but I'm being told it should work).
I have a Matlab script, "myscript.m" which needs to use a C-programmed function, "myfunc.c" which in turn has been compiled (or "lives") inside a library, "mylib.dll". In order for "myscript.m" to access and execute "myfunc.c" there is also a "myfunc.m" Matlab script, which is being called in "myscript.m". However, "myfunc.m" is a completely empty file, except for some comments (in no particular format or pattern either). All of these files were given to me and I'm being told that as it is, Matlab should correctly execute "myfunc.c" because "myfunc.m" is acting as a wrapper.
The problem I'm having is that it is of course not working. When I execute the line in "myscript.m" that reads:
output1 = myfunc(input1, input2);
I get Matlab errors saying that I'm trying to execute a script as a function. In my mind, this is correct, because I'm sending input and requesting outputs to something that is stated to have neither, since "myfunc.m" is empty (except for the comments, which are NOT code).
I think that Matlab has no way (as it is) to know that I want to access the C code inside "mylib.dll". I also DO NOT have a header file "mylib.h" so that I can load the library in Matlab using loadlibrary.
My question is, given the current description, could this execution work at all? Is there any way to make it work, or something that I'm missing? One possibility is that this is an old wrapper format and it currently doesn't work anymore.
If anyone knows anything or has suggestions, they will be greatly appreciated. Thanks!!!
Hugo
it sounds like myfunc.c is a mex file. try compiling it in Matlab using mex command. The dll extension is maybe old version matlab.
Have you tried with loadlibrary? You need a .h file but it's easy recreate on if you know the prototype of the function.

Resources