# KDB C++ Windows Project

**URL:** <https://forum.kx.com/t/kdb-c-windows-project/7252>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [August 21, 2011, 4:08pm UTC](https://forum.kx.com/t/kdb-c-windows-project/7252 "2011-08-21T16:08:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel2](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Daniel2](https://forum.kx.com/u/Daniel2)\
**Post date:** [August 21, 2011, 4:08pm UTC](https://forum.kx.com/t/kdb-c-windows-project/7252/1 "2011-08-21T16:08:00Z")

</div>

Hi,I am trying to access a q process with a c++ program on my windowsmachine.I have added q.lib to the linker settings and I have c.obj in theproject directory. (also tried the debug directory)I still recieve the error “The application was unable to startcorrectly (0xc0000005). Click OK to close the application”.Anyone got any ideas?Thanks.

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [August 21, 2011, 10:48pm UTC](https://forum.kx.com/t/kdb-c-windows-project/7252/2 "2011-08-21T22:48:00Z")

</div>

you’ve probably already found

https://code.kx.com/trac/wiki/Cookbook/InterfacingWithC

https://code.kx.com/trac/wiki/Cookbook/ExtendingWithC

but maybe not this

http://kx.com/q/c/c/readme.txt

the key point being which case you want

```
1. c dynamic load called by q, e.g. analytics2. c dynamic load callbacks into q, e.g. feedhandlers3. c clients talking to q servers. e.g. feedhandlers and clients(link with c.o)

```

I’m guessing you are #3, as you are linking to c.obj - in which case you don’t need q.lib!

You would link with q.lib when using #1 or #2.

You would link with c.lib when using #3 and c.dll.

Remember for #3, you should initialize memory before creating any k objects.

---

<div class="post-metadata">

**Author:** ![Daniel2](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Daniel2](https://forum.kx.com/u/Daniel2)\
**Post date:** [August 21, 2011, 11:10pm UTC](https://forum.kx.com/t/kdb-c-windows-project/7252/3 "2011-08-21T23:10:00Z")

</div>

Hi Charles,Thanks that seems to have worked for me.I had been using an old topic on here so they must have been doing 1or 2.For 3 can you tell me how this section applies to me?[https://code.kx.com/trac/wiki/Cookbook/InterfacingWithC#WindowsandtheloadlibraryapiThanks,DanielOn](https://code.kx.com/trac/wiki/Cookbook/InterfacingWithC#WindowsandtheloadlibraryapiThanks,DanielOn) Aug 22, 7:48?am, Charles Skelton \<char…\> wrote:\> you’ve probably already found\>\> [https://code.kx.com/trac/wiki/Cookbook/InterfacingWithChttps://code.kx.com/trac/wiki/Cookbook/ExtendingWithC&gt;&gt](https://code.kx.com/trac/wiki/Cookbook/InterfacingWithChttps://code.kx.com/trac/wiki/Cookbook/ExtendingWithC&gt;&gt); but maybe not this\>\> [http://kx.com/q/c/c/readme.txt&gt;&gt](http://kx.com/q/c/c/readme.txt&gt;&gt); the key point being which case you want\>\> 1. c dynamic load called by q, e.g. analytics\> 2. c dynamic load callbacks into q, e.g. feedhandlers\> 3. c clients talking to q servers. e.g. feedhandlers and clients(link with c.o)\>\> I’m guessing you are #3, as you are linking to c.obj - in which case you\> don’t need q.lib!\>\> You would link with q.lib when using #1 or #2.\> You would link with c.lib when using #3 and c.dll.\>\> Remember for #3, you should initialize memory before creating any k objects.\>\>\>\>\>\>\>\> On Sun, Aug 21, 2011 at 5:08 PM, Daniel \<cas…\> wrote:\> \> Hi,\>\> \> I am trying to access a q process with a c++ program on my windows\> \> machine.\>\> \> I have added q.lib to the linker settings and I have c.obj in the\> \> project directory. (also tried the debug directory)\> \> I still recieve the error “The application was unable to start\> \> correctly (0xc0000005). Click OK to close the application”.\>\> \> Anyone got any ideas?\>\> \> Thanks.\>\> \> –\> \>

Submitted via Google Groups\</cas…\>\</char…\>

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [August 22, 2011, 7:11am UTC](https://forum.kx.com/t/kdb-c-windows-project/7252/4 "2011-08-22T07:11:00Z")

</div>

For #3, that link is relevant for writing a shared library (dll), not a standalone executable; and even then, a dll that is loaded explicitly via&nbsp;loadlibrary&nbsp;rather than binding with c.lib. If you are using&nbsp;loadlibrary, then you can use the single threaded version of c.dll.

thanks

---

<div class="post-metadata">

**Author:** ![Daniel2](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Daniel2](https://forum.kx.com/u/Daniel2)\
**Post date:** [August 22, 2011, 12:00pm UTC](https://forum.kx.com/t/kdb-c-windows-project/7252/5 "2011-08-22T12:00:00Z")

</div>

Thanks Charles that makes senseOn Aug 22, 4:11?pm, Charles Skelton \<char…\> wrote:\> For #3, that link is relevant for writing a shared library (dll), not a\> standalone executable; and even then, a dll that is loaded explicitly\> via loadlibrary rather\> than binding with c.lib. If you are using loadlibrary, then you can use the\> single threaded version of c.dll.\>\> thanks\>\>\>\>\>\>\>\> On Mon, Aug 22, 2011 at 12:10 AM, Daniel \<cas…\> wrote:\> \> Hi Charles,\>\> \> Thanks that seems to have worked for me.\> \> I had been using an old topic on here so they must have been doing 1\> \> or 2.\>\> \> For 3 can you tell me how this section applies to me?\>\> \>[https://code.kx.com/trac/wiki/Cookbook/InterfacingWithC#Windowsandthe...&gt;&gt](https://code.kx.com/trac/wiki/Cookbook/InterfacingWithC#Windowsandthe...&gt;&gt); \> Thanks,\> \> Daniel\>\> \> On Aug 22, 7:48 am, Charles Skelton \<char…\> wrote:\> \> \> you’ve probably already found\>\> \>[https://code.kx.com/trac/wiki/Cookbook/InterfacingWithChttps://code.k...&gt;&gt](https://code.kx.com/trac/wiki/Cookbook/InterfacingWithChttps://code.k...&gt;&gt); \> \> but maybe not this\>\> \> \>[http://kx.com/q/c/c/readme.txt&gt;&gt](http://kx.com/q/c/c/readme.txt&gt;&gt); \> \> the key point being which case you want\>\> \> \> 1. c dynamic load called by q, e.g. analytics\> \> \> 2. c dynamic load callbacks into q, e.g. feedhandlers\> \> \> 3. c clients talking to q servers. e.g. feedhandlers and clients(link\> \> with c.o)\>\> \> \> I’m guessing you are #3, as you are linking to c.obj - in which case you\> \> \> don’t need q.lib!\>\> \> \> You would link with q.lib when using #1 or #2.\> \> \> You would link with c.lib when using #3 and c.dll.\>\> \> \> Remember for #3, you should initialize memory before creating any k\> \> objects.\>\> \> \> On Sun, Aug 21, 2011 at 5:08 PM, Daniel \<cas…\> wrote:\> \> \> \> Hi,\>\> \> \> \> I am trying to access a q process with a c++ program on my windows\> \> \> \> machine.\>\> \> \> \> I have added q.lib to the linker settings and I have c.obj in the\> \> \> \> project directory. (also tried the debug directory)\> \> \> \> I still recieve the error “The application was unable to start\> \> \> \> correctly (0xc0000005). Click OK to close the application”.\>\> \> \> \> Anyone got any ideas?\>\> \> \> \> Thanks.\>\> \> \> \> –\> \> \> \> You received this message because you are subscribed to the Google\> \> Groups\> \> \> \> “Kdb+ Personal Developers” group.\> \> \> \> To post to this group, send email to [personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com)\> \> .\> \> \> \> To unsubscribe from this group, send email to\> \> \> \> [personal-kdbplus+unsubscribe@googlegroups.com](mailto:personal-kdbplus+unsubscribe@googlegroups.com).\> \> \> \> For more options, visit this group at\> \> \> \>[http://groups.google.com/group/personal-kdbplus?hl=en.&gt;&gt](http://groups.google.com/group/personal-kdbplus?hl=en.&gt;&gt); \> –\> \>

Submitted via Google Groups\</cas…\>\</char…\>\</cas…\>\</char…\>
