Hi all,does anybody succesfully compile a c++ dll to be used in kdb?I succesfully compile the following code on msvc 2010 as a dll.But the functions are not recognized by kdb. Please see the followingcode:# include <k.h>__declspec(dllexport) K__cdecl foo(K x){return x;}A dll called ex4.dll is created.Using the following staement in kdbfoo: ex4 2:(
foo;1);should load this dll in kdb. But kdb reported that the procedure foois not found in the module ex4.Can anybody help?Am i missing something ?? Do i need to add some compiler specificparameters ?The compiler from msvc cannot be used ???Thanks for any help or hint.Regards,Kim</k.h>
Looks like you are missing module definition file in VS. Add file
named ex4.def with the following contents:
LIBRARY “ex4”
EXPORTS
foo
And add it in project properties (Linker->Input->Module Definition
File = ex4.def). If it still doesn’t work then check it with
Dependency Walker (you might be missing some required dll’s on your
PATH).
Regards,
Kamil
Hi Kamil,thanks for your reply.On 26 Feb., 09:30, Kamil Ja?kiewicz <jaskiewicz.ka…>wrote:> Looks like you are missing module definition file in VS. Add file> named ex4.def with the following contents:>> LIBRARY “ex4”>> EXPORTS> ? ? foo>> And add it in project properties (Linker->Input->Module Definition> File = ex4.def).In newer compiler versions, you can export data, functions, classes,or class member functions from a DLL using the __declspec(dllexport)keyword.So that’s why i didnt define a *.def file.> If it still doesn’t work then check it with> Dependency Walker (you might be missing some required dll’s on your> PATH).I checked the dependy with Walker. And Walker really recognize thefunction foo. See the output from Walkerstruct k0 * foo(struct k0 *)It also shows dependency on others dlls:EX4.DLLKERNEL32.DLLMSVCR100.DLLNTDLL.DLLThese are also needed from kdb???I will try to load it from kdb also.Regards,Kim>> Regards,> Kamil>> On 25 February 2011 23:30, kuentang <kuent…> wrote:>> > Hi all,>> > does anybody succesfully compile a c++ dll to be used in kdb?>> > I succesfully compile the following code on msvc 2010 as a dll.> > But the functions are not recognized by kdb. Please see the following> > code:>> > # include <k.h>> >__declspec(dllexport) K __cdecl foo(K x){return x;}>> > A dll called ex4.dll is created.>> > Using the following staement in kdb>> > foo: ex4 2:(
foo;1);>> > should load this dll in kdb. But kdb reported that the procedure foo> > is not found in the module ex4.> > Can anybody help?>> > Am i missing something ?? Do i need to add some compiler specific> > parameters ?> > The compiler from msvc cannot be used ???>> > Thanks for any help or hint.>> > Regards,>> > Kim>> > –> >
Submitted via Google Groups</k.h></kuent…></jaskiewicz.ka…>
Hi Kamil,i followed your tips using the def file. And it works. Thx for yourhelp again.The conclusion is that the keyword __declspec(dllexport) frommicrodoof is not relyable.Cheers,KimOn 26 Feb., 09:30, Kamil Ja?kiewicz <jaskiewicz.ka…>wrote:> Looks like you are missing module definition file in VS. Add file> named ex4.def with the following contents:>> LIBRARY “ex4”>> EXPORTS> ? ? foo>> And add it in project properties (Linker->Input->Module Definition> File = ex4.def). If it still doesn’t work then check it with> Dependency Walker (you might be missing some required dll’s on your> PATH).>> Regards,> Kamil>> On 25 February 2011 23:30, kuentang <kuent…> wrote:>> > Hi all,>> > does anybody succesfully compile a c++ dll to be used in kdb?>> > I succesfully compile the following code on msvc 2010 as a dll.> > But the functions are not recognized by kdb. Please see the following> > code:>> > # include <k.h>> > __declspec(dllexport) K__cdecl foo(K x){return x;}>> > A dll called ex4.dll is created.>> > Using the following staement in kdb>> > foo: ex4 2:(
foo;1);>> > should load this dll in kdb. But kdb reported that the procedure foo> > is not found in the module ex4.> > Can anybody help?>> > Am i missing something ?? Do i need to add some compiler specific> > parameters ?> > The compiler from msvc cannot be used ???>> > Thanks for any help or hint.>> > Regards,>> > Kim>> > –> >
Submitted via Google Groups</k.h></kuent…></jaskiewicz.ka…>
On 26 February 2011 11:19, kuentang wrote:
>
> Hi Kamil,
>
> thanks for your reply.
>
> On 26 Feb., 09:30, Kamil Ja=C5=9Bkiewicz <jaskiewicz.ka…>
> wrote:
>> Looks like you are missing module definition file in VS. Add file
>> named ex4.def with the following contents:
>>
>> LIBRARY “ex4”
>>
>> EXPORTS
>> =C2=A0 =C2=A0 foo
>>
>> And add it in project properties (Linker->Input->Module Definition
>> File =3D ex4.def).
>
> In newer compiler versions, you can export data, functions, classes,
> or class member functions from a DLL using the __declspec(dllexport)
> keyword.
> So that’s why i didnt define a *.def file.
>
>> If it still doesn’t work then check it with
>> Dependency Walker (you might be missing some required dll’s on your
>> PATH).
>
> I checked the dependy with Walker. And Walker really recognize the
> function =C2=A0foo. See the output from Walker
>
> struct k0 * foo(struct k0 *)
>
> It also shows dependency on others dlls:
>
> EX4.DLL
> KERNEL32.DLL
> MSVCR100.DLL
> NTDLL.DLL
>
> These are also needed from kdb???
>
They are needed to be on your PATH.
I’ve sent you working example.
Regards,
Kamil
> I will try to load it from kdb also.
>
> Regards,
>
> Kim
>
>>
>> Regards,
>> Kamil
>>
>> On 25 February 2011 23:30, kuentang <kuent…> wrote:
>>
>> > Hi all,
>>
>> > does anybody succesfully compile a c++ dll to be used in kdb?
>>
>> > I succesfully compile the following code on msvc 2010 as a dll.
>> > But the functions are not recognized by kdb. Please see the following
>> > code:
>>
>> > # include <k.h>
>> >__declspec(dllexport) K __cdecl foo(K x){return x;}
>>
>> > A dll called ex4.dll is created.
>>
>> > Using the following staement in kdb
>>
>> > foo: ex4 2:(
foo;1);
>>
>> > should load this dll in kdb. But kdb reported that the procedure foo
>> > is not found in the module ex4.
>> > Can anybody help?
>>
>> > Am i missing something ?? Do i need to add some compiler specific
>> > parameters ?
>> > The compiler from msvc cannot be used ???
>>
>> > Thanks for any help or hint.
>>
>> > Regards,
>>
>> > Kim
>>
>> > –
>> > You received this message because you are subscribed to the Google Gro=
ups “Kdb+ Personal Developers” group.
>> > To post to this group, send email to personal-kdbplus@googlegroups.com=
.
>> > To unsubscribe from this group, send email to personal-kdbplus+unsubsc=
ribe@googlegroups.com.
>> > For more options, visit this group athttp://groups.google.com/group/pe=
rsonal-kdbplus?hl=3Den.
>
> –
>
Submitted via Google Groups</k.h></kuent…></jaskiewicz.ka…>
Hi Kamil,i tested your demo project. And it works out of the box. Thanksagain.On the other hand what i ’ ve seen from other sources are that usingthe keyword __declspec(dllexport) should be enoughto export thefunctions.Do you have a working demo project where the def file is not needed ?Regards,KimOn 26 Feb., 11:58, Kamil Ja?kiewicz <jaskiewicz.ka…>wrote:> On 26 February 2011 11:19, kuentang <kuent…> wrote:>>>> > Hi Kamil,>> > thanks for your reply.>> > On 26 Feb., 09:30, Kamil Ja?kiewicz <jaskiewicz.ka…>> > wrote:> >> Looks like you are missing module definition file in VS. Add file> >> named ex4.def with the following contents:>> >> LIBRARY “ex4”>> >> EXPORTS> >> ? ? foo>> >> And add it in project properties (Linker->Input->Module Definition> >> File = ex4.def).>> > In newer compiler versions, you can export data, functions, classes,> > or class member functions from a DLL using the __declspec(dllexport)> > keyword.> > So that’s why i didnt define a *.def file.>> >> If it still doesn’t work then check it with> >> Dependency Walker (you might be missing some required dll’s on your> >> PATH).>> > I checked the dependy with Walker. And Walker really recognize the> > function ?foo. See the output from Walker>> > struct k0 * foo(struct k0 *)>> > It also shows dependency on others dlls:>> > EX4.DLL> > KERNEL32.DLL> > MSVCR100.DLL> > NTDLL.DLL>> > These are also needed from kdb???>> They are needed to be on your PATH.>> I’ve sent you working example.>> Regards,> Kamil>> > I will try to load it from kdb also.>> > Regards,>> > Kim>> >> Regards,> >> Kamil>> >> On 25 February 2011 23:30, kuentang <kuent…> wrote:>> >> > Hi all,>> >> > does anybody succesfully compile a c++ dll to be used in kdb?>> >> > I succesfully compile the following code on msvc 2010 as a dll.> >> > But the functions are not recognized by kdb. Please see the following> >> > code:>> >> > # include <k.h>> >> >__declspec(dllexport) K __cdecl foo(K x){return x;}>> >> > A dll called ex4.dll is created.>> >> > Using the following staement in kdb>> >> > foo: ex4 2:(
foo;1);>> >> > should load this dll in kdb. But kdb reported that the procedure foo> >> > is not found in the module ex4.> >> > Can anybody help?>> >> > Am i missing something ?? Do i need to add some compiler specific> >> > parameters ?> >> > The compiler from msvc cannot be used ???>> >> > Thanks for any help or hint.>> >> > Regards,>> >> > Kim>> >> > –> >> >
Submitted via Google Groups</k.h></kuent…></jaskiewicz.ka…></kuent…></jaskiewicz.ka…>
On 27 February 2011 20:31, kuentang wrote:
>
> Hi Kamil,
>
> i tested your demo project. And it works out of the box. Thanks
> again.
>
> On the other hand what i ’ ve seen from other sources are that using
> the keyword __declspec(dllexport) should be enoughto export the
> functions.
> Do you have a working demo project where the def file is not needed ?
I always used DEF files in VS projects. But quick google says that you
don’t have use it. But then the function name has a leading underscore
(_):
http://stackoverflow.com/questions/3314941/export-function-from-a-dll-use-d=
ef-file-or-dllexport
http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/cb45d1ba-5f7c-=
4e34-9d63-2b7991eb50ed
Regards,
Kamil
>
> Regards,
>
> Kim
>
>
> On 26 Feb., 11:58, Kamil Ja=C5=9Bkiewicz <jaskiewicz.ka…>
> wrote:
>> On 26 February 2011 11:19, kuentang <kuent…> wrote:
>>
>>
>>
>> > Hi Kamil,
>>
>> > thanks for your reply.
>>
>> > On 26 Feb., 09:30, Kamil Ja=C5=9Bkiewicz <jaskiewicz.ka…>
>> > wrote:
>> >> Looks like you are missing module definition file in VS. Add file
>> >> named ex4.def with the following contents:
>>
>> >> LIBRARY “ex4”
>>
>> >> EXPORTS
>> >> =C2=A0 =C2=A0 foo
>>
>> >> And add it in project properties (Linker->Input->Module Definition
>> >> File =3D ex4.def).
>>
>> > In newer compiler versions, you can export data, functions, classes,
>> > or class member functions from a DLL using the__declspec(dllexport)
>> > keyword.
>> > So that’s why i didnt define a *.def file.
>>
>> >> If it still doesn’t work then check it with
>> >> Dependency Walker (you might be missing some required dll’s on your
>> >> PATH).
>>
>> > I checked the dependy with Walker. And Walker really recognize the
>> > function =C2=A0foo. See the output from Walker
>>
>> > struct k0 * foo(struct k0 *)
>>
>> > It also shows dependency on others dlls:
>>
>> > EX4.DLL
>> > KERNEL32.DLL
>> > MSVCR100.DLL
>> > NTDLL.DLL
>>
>> > These are also needed from kdb???
>>
>> They are needed to be on your PATH.
>>
>> I’ve sent you working example.
>>
>> Regards,
>> Kamil
>>
>> > I will try to load it from kdb also.
>>
>> > Regards,
>>
>> > Kim
>>
>> >> Regards,
>> >> Kamil
>>
>> >> On 25 February 2011 23:30, kuentang <kuent…> wrote:
>>
>> >> > Hi all,
>>
>> >> > does anybody succesfully compile a c++ dll to be used in kdb?
>>
>> >> > I succesfully compile the following code on msvc 2010 as a dll.
>> >> > But the functions are not recognized by kdb. Please see the followi=
ng
>> >> > code:
>>
>> >> > # include <k.h>
>> >> > __declspec(dllexport) K__cdecl foo(K x){return x;}
>>
>> >> > A dll called ex4.dll is created.
>>
>> >> > Using the following staement in kdb
>>
>> >> > foo: ex4 2:(
foo;1);
>>
>> >> > should load this dll in kdb. But kdb reported that the procedure fo=
o
>> >> > is not found in the module ex4.
>> >> > Can anybody help?
>>
>> >> > Am i missing something ?? Do i need to add some compiler specific
>> >> > parameters ?
>> >> > The compiler from msvc cannot be used ???
>>
>> >> > Thanks for any help or hint.
>>
>> >> > Regards,
>>
>> >> > Kim
>>
>> >> > –
>> >> > 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.
>> >> > To unsubscribe from this group, send email to personal-kdbplus+unsu=
bscribe@googlegroups.com.
>> >> > For more options, visit this group athttp://groups.google.com/group=
/personal-kdbplus?hl=3Den.
>>
>> > –
>> > You received this message because you are subscribed to the Google Gro=
ups “Kdb+ Personal Developers” group.
>> > To post to this group, send email to personal-kdbplus@googlegroups.com=
.
>> > To unsubscribe from this group, send email to personal-kdbplus+unsubsc=
ribe@googlegroups.com.
>> > For more options, visit this group athttp://groups.google.com/group/pe=
rsonal-kdbplus?hl=3Den.
>
> –
>
Submitted via Google Groups</k.h></kuent…></jaskiewicz.ka…></kuent…></jaskiewicz.ka…>