# Invalid memory API call

**URL:** <https://forum.sierrawireless.com/t/invalid-memory-api-call/5672>\
**Category:** Open AT\
**Created:** [June 21, 2012, 8:30am UTC](https://forum.sierrawireless.com/t/invalid-memory-api-call/5672 "2012-06-21T08:30:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierreandre](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@pierreandre](https://forum.sierrawireless.com/u/pierreandre)\
**Post date:** [June 21, 2012, 8:30am UTC](https://forum.sierrawireless.com/t/invalid-memory-api-call/5672/1 "2012-06-21T08:30:15Z")

</div>

Hi

I make use of the [boost](http://www.boost.org) libs. Under certain conditions, I get a “Invalid memory API call” trace. Unfortunately, the backtraces are not much help and I’ve been unable to step to the exact spot where it occurs using the debugger.

I’m pretty sure I’m causing it with a pointer I’m passing to boost, but the pointer looks valid when I pass it.

I cannot find any documentation on the error message I receive. Is it produced by the OS? What exactly does mean?

Any help would be greatly appreciated.

Backtrace:

```auto
Invalid memory API call
	Unknown function (67250)
	Unknown function (34387)
	Unknown function (3443d)
	Unknown function (2fee7)
	Unknown function (208d5)
	adlint_trcError+1a
	adlint_errHalt+44
	_sbrk+8
	_sbrk_r+10
	_malloc_r+28a
	_realloc_r+238
	realloc+10
	d_growable_string_callback_adapter+64
	d_demangle_callback+10e
```

---

<div class="post-metadata">

**Author:** ![paruthiv](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@paruthiv](https://forum.sierrawireless.com/u/paruthiv)\
**Post date:** [June 26, 2012, 11:02am UTC](https://forum.sierrawireless.com/t/invalid-memory-api-call/5672/2 "2012-06-26T11:02:58Z")

</div>

Hi,

I was just curious to know how could you use a C++ lib such as “boost” with OpenAT and what is the need ❓

Regards,  
Paruthiv

---

<div class="post-metadata">

**Author:** ![pierreandre](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@pierreandre](https://forum.sierrawireless.com/u/pierreandre)\
**Post date:** [June 26, 2012, 12:02pm UTC](https://forum.sierrawireless.com/t/invalid-memory-api-call/5672/3 "2012-06-26T12:02:29Z")

</div>

Boost is mostly just header files, and they work pretty well using the gcc EABI toolchain. I added the following compiler flags (Project settings-\>C/C++ Build-\>Settings-\>Miscellaneous):

```auto
-std=gnu++0x -Wno-write-strings -Wno-comment -Wno-psabi
```

The only compiled boost lib I use is the serialization, but I built it using the ARM EABI gcc compiler that ships with Developer Studio. I just made sure to mimic the correct compiler flags as per DS. I built the libs as a static lib and then link it into my project like any other one. Boost was pretty easy, as it has a well documented cross-compile method, using the boost.build tool.

I think you should be able to use any third party lib that can be built with gcc/g++.

---

<div class="post-metadata">

**Author:** ![mferno](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mferno](https://forum.sierrawireless.com/u/mferno)\
**Post date:** [May 27, 2013, 8:51am UTC](https://forum.sierrawireless.com/t/invalid-memory-api-call/5672/4 "2013-05-27T08:51:53Z")

</div>

Hi pierreandre!

It seems you are quite experienced with using third party libs in DS and Sierra Wireless modems.

I need some help, I am trying to use the third party C lib Mosquitto on my FXT009 but I am having some troubles getting it to work.

Is there any standard procedures one have to do to make third party libs work with Open AT OS?

Thanks!

---

<div class="post-metadata">

**Author:** ![flu](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/flu/32/5130_2.png) [@flu](https://forum.sierrawireless.com/u/flu)\
**Post date:** [June 10, 2013, 2:15pm UTC](https://forum.sierrawireless.com/t/invalid-memory-api-call/5672/5 "2013-06-10T14:15:58Z")

</div>

When porting code to Open AT Framework, you need to replace functions like realloc, alloc, free, strdup, exit, _printf.  
Open AT OS functions like adl\_mem_ and adl\_trc\* can be used for that purpose.

Also, functions involving stdio (open, read, write, close, tell, seek) can be replaced using adl\_fs\* (File System).
